How to get the full pathname of the current shell script?
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-03-17T19:15:10Z
Indexed on
2010/03/17
19:21 UTC
Read the original article
Hit count: 272
Is there a less brute-force way to do this?
#!/bin/ksh
THIS_SCRIPT=$(/usr/bin/readlink -f $(echo $0 | /bin/sed "s,^[^/],$PWD/&,"))
echo $THIS_SCRIPT
I'm stuck using ksh
but would prefer a solution that works in bash
too (which I think this does).
© Stack Overflow or respective owner