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-valid path like
  /home/madduck/edu/swat/../../bin/myscript

but this method only works for relative paths. if i call myscript as
  /home/madduck/bin/myscript

then this method yields

  /home/madduck/edu/swat//home/madduck/bin/myscript

which is a different path (and most likely invalid).

i *could* check the first character for a '/' and act accordingly, but
there's got to be an easier way...

martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; [EMAIL PROTECTED]
-- 
i took an iq test and the results were negative.

Reply via email to