01-30-2008
4,996,
477
Join Date: Dec 2003
Last Activity: 12 June 2016, 11:03 PM EDT
Location: /dev/ph
Posts: 4,996
Thanks Given: 73
Thanked 477 Times in 439 Posts
Juts to expand on what dangral said , POSIX states $0 is the name of the shell script
* If you invoke the shell script as "./shellscript", then $0 will be "./shellscript"
* If you invoke the shell script as "/home/mpf/shellscript", then $0 will be "/home/mpf/shellscript"
One caveat, however, is that if you define functions in ksh using the
function funcname { .... } syntax then $0 will be set to the function name, not
the name of the shell script.