On Wed, 27 Feb 2008, Mike Miller wrote:

> On Wed, 27 Feb 2008, Mike Miller wrote:
>
>> On Wed, 27 Feb 2008, Florin Iucha wrote:
>> 
>>> Well, what happens if $SCRIPT is not in $PATH?  'which' won't find 
>>> it....
>> 
>> Yes it will.
>> 
>> $ mkdir foo
>> $ touch foo/script
>> $ chmod 755 foo/script
>> $ which foo/script
>> ./foo/script
>
> Oops.  What was I thinking?  Yes, it doesn't find the full path, which 
> is what you want.  You were right, Florin, as usual.


Here's the problem:  It did work for me when I used it in a script, then 
it didn't work from the command line.  The reason is that I have an alias 
that added the "--show-dot" option:

$ which which
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
         /usr/bin/which

But within the script, it was using /usr/bin/which instead of the alias. 
You can turn off the alias with a backslash:

$ \which which
/usr/bin/which

So I will stick by my earlier idea that "which" is the way to go, but you 
have to be sure that you are getting the full path from "which."  Will use 
of "\which" guarantee that full paths are given?

Mike