Re: obtaining the absolute path of a shell script within itself

2001-07-21 Thread Martin F. Krafft
also sprach Leonard Stiles (on Sat, 21 Jul 2001 05:45:57PM +0200): > abspath=$(cd ${1%/*} && echo $PWD/${0##*/}) man, i *could* have figured that out myself. beautuitous, as i like to say thanks! martin; (greetings from the heart of the sun.) \ echo mailto: !#^."<*>"|tr "<*> m

Re: obtaining the absolute path of a shell script within itself

2001-07-21 Thread Leonard Stiles
"Martin F. Krafft" <[EMAIL PROTECTED]> writes: > how can i obtain the absolute path of the script within itself, > > echo `pwd`/$0, > > returns a POSIX-valid path like > /home/madduck/edu/swat/../../bin/myscript > > but this method only works for relative paths. if i call myscript as > /home/m

obtaining the absolute path of a shell script within itself

2001-07-21 Thread Martin F. Krafft
hi, in a shell script, $0 contains the name of the script as it was called. i.e. ./myscript ../../myscript /home/madduck/bin/myscript. how can i obtain the absolute path of the script within itself, given this information. one possible solution is echo `pwd`/$0, which returns a POSIX-val