On the contrary, standard shell variable $0 - contains a full path to the program location in the directory structure, no matter from what directory the program was called
If the shell found it by $PATH search, $0 will be simply the program name with no directory and you will have to repeat the PATH search yourself. (And the pathological case: the user did "PATH=something yourprog", where "something" does not contain the directory holding "yourprog".)
There is no 100% reliable way to get the executable without using something like /proc/self/exe (only on Linux).
-- brandon s allbery allbery.b@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms