On Wed, 27 Feb 2008, Brock Noland wrote:
>> (1) absolute path
>>     example:  /usr/local/bin/script.bash
>
> [[ ${0:0:1} == "/" ]]
I don't know what that does or how it is used.  I put it in a script and 
nothing happened.
>> (2) relative path
>>     example:  ../../../local/bin/script.bash
>>     example:  ./local/bin/script.bash
>>     example:  local/bin/script.bash
>
> $PWD/`dirname`
>
>> (3) in search path ($PATH)
>>     example:  script.bash
>
> which $0
>
>> (4) as above but using globbing
>>     example:  local/bin/scri*
>
> $PWD/`dirname`
>
>
> If you are correct that these are the only possibilities. Check for 1
> and 3 first, then go with 3/4.
Are you saying that it is better to have a series of checks followed by a 
series of different commands, one for each case, instead of doing this...
echo $(dirname "$(\which "$0")")
...which seems to always work for any case?
Mike