> (1) absolute path
>     example:  /usr/local/bin/script.bash

[[ ${0:0:1} == "/" ]]

> (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.

Brock