Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

which command...

Status
Not open for further replies.

tchatzi

Technical User
Dec 15, 2004
744
GR
I just got fedora core 2 and it doesn't have the which command that i need for a particular software.
Is there any place i can find the which utility or enable it some way?

Thanks.......


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
If you're talking about the command which prints out the full path of shell commands? It's on my FC2 box. Did you install the "which" RPM package?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
i did install it but there is no 'which' executable, nor any 'which' shell script.
locate which
comes up with these
Code:
/root/sources/ircii/help/which
/root/sources/ActiveTcl8.4.9.1.139183-linux-ix86/lib/xotcl1.3.6/apps/utils/xo-whichPkg
/etc/profile.d/which-2.sh
/usr/share/comps-extras/whichcd.py
/usr/share/man/man1/which.1.gz
/usr/share/man/man1/kpsewhich.1.gz
/usr/share/man/man1/ypwhich.1.gz
/usr/share/emacs/21.3/lisp/which-func.elc
/usr/share/info/which.info.gz
/usr/share/doc/bash-2.05b/functions/which
/usr/share/doc/which-2.16
/usr/share/doc/which-2.16/EXAMPLES
/usr/share/doc/which-2.16/README
/usr/share/doc/which-2.16
/usr/local/share/irc/help/which
/usr/local/ActiveTcl/lib/xotcl1.3.6/apps/utils/xo-whichPkg
/usr/bin/ypwhich
/usr/bin/sgmlwhich
/usr/bin/kpsewhich
/usr/lib/ooo-1.1/program/python-core-2.2.2/lib/whichdb.py
/usr/lib/python2.3/whichdb.py
/usr/lib/python2.3/test/test_whichdb.py
/usr/lib/python2.3/whichdb.pyo
/usr/lib/python2.3/whichdb.pyc
Is it something from this list?


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
what about 'wish' ?


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
i just got it, I installed tcl and tk and all if fine with 'wish'.

But still no 'which' :(


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
What does "rpm -qa | grep -i which" tell you?
If it's not there, go find the appropriate "which".rpm and install it.



D.E.R. Management - IT Project Management Consulting
 
Here's a quick and dirty [tt]which[/tt] in Korn Shell...
Code:
#!/bin/ksh

[[ "${1}" = "" ]] && exit

FILE="${1}"
DIRS=$(print ${PATH}|sed 's/::/:.:/g;s/:$/:./g;s/:/ /g')

for DIR in ${DIRS}
do
    [[ -x ${DIR}/${FILE} ]] && print ${DIR}/${FILE} && exit
done

print "no ${FILE} in ${DIRS}"

exit
If you can't find the right tool, make your own tools!

Hope this helps.
 
daver
--------
> rpm -qa | grep -i which
gives me
which-2.16-2

Sam
-------
I change the first line to '#!/bin/sh'
and the print comands to echo
and it works great.

The thing is that i got AOL with BT Voyager 105 modem, and i found these drivers for this modem and when you try to startmodem it says that 'which command not found'.

Now it doesn't, but it says
[EciAdsl 5/5] Setting up route table...
Waiting for tap0... ..........
no tap0 device found

I dont even know why it search for a tap device. Is it something like tun0?
I don't know........ I guess i have to stay with a windows laptop as my proxy server for my fd2.




``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
WTF? Where did the tun/tap conversation come from?

Do this to find "which"

"cd /; find -inane *which*"

It's obviously not in your search path, but it IS installed.

D.E.R. Management - IT Project Management Consulting
 
I woke up like half hour ago, and i realise that now there is a 'which' executable in my /usr/bin
It must have come up when i try to reinstall the which-2.16-2.rpm and because i shutdown the pc yesterday, today is there. ( I don't know why thought)

Anyway for some reason now i do have the which executable and is not the one that Sam gave me.
I rename the script to which and put it into /usr/local/bin which is in my path. But when i did > which which i got
Code:
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
        /usr/bin/which
I deleted the script 'which' that Sam gave me from /usr/local/bin, (just in case), and i run again 'which' and it works fine so it must have come up when i reinstal it.

Now the problem changed and it is with this tap device.
Did anyone had the same problem, trying to connect a linux with AOL and BT ?
What is this tap0 anyway? Is there any chance to create it?


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
That alias for [tt]which[/tt] is correct, and the output you got was correct. What that alias does is show you if the command you are trying to find with [tt]which[/tt] is an alias or an actual executable somewhere. Since you did a [tt]which which[/tt], it showed you the alias definition, then where the executable was located.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top