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
"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
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
3 matches
Mail list logo