Mikkel L. Ellertson wrote:
Alan Evans wrote:
> On Tue, May 5, 2009 at 5:39 AM, Mike Cloaked wrote:
>> Usually a good way to find where a command is would be to use the
"which"
>> command. In this case:
>> [mike@gestalt ~]$ which lsof
>> /usr/sbin/lsof
> How is that going to work if /usr/sbin isn't already in your path?
>
It does work. Try it yourself.
$ which lsof
/usr/sbin/lsof
$ echo $PATH
/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/mikkel/bin
You'll note that /usr/sbin *is* in your path and the man page for which
says:
DESCRIPTION
Which takes one or more arguments. For each of its arguments it
prints
to stdout the full path of the executables that would have been exe-
cuted when this argument had been entered at the shell prompt. It
does
this by searching for an executable or script in the directories
listed
in the environment variable PATH using the same algorithm as bash(1).
So if you hadn't had /usr/sbin in your PATH, then "which lsof" would
have returned nothing - so it isn't useful for this situation...
[sam@sam ~]$ echo $PATH
/usr/kerberos/bin:/usr/bin:/bin:/usr/sbin:/sbin
[sam@sam ~]$ which lsof
/usr/sbin/lsof
[sam@sam ~]$ export PATH=/usr/kerberos/bin:/usr/bin:/bin:/sbin
[sam@sam ~]$ which lsof
/usr/bin/which: no lsof in (/usr/kerberos/bin:/usr/bin:/bin:/sbin)
--
Sam
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines