aad@stpstn.UUCP (Anthony A. Datri) (06/05/88)
I want to write a script that will have multiple links to it, and be able to tell what name it was invoked with. Ideas? -- Anthony A. Datri 8 Bridge End Farm Lane SysAdmin Sandy Hook, CT 06482 Stepstone Corporation (203)426-8336
wu@spot.UUCP (06/06/88)
In article <1813@stpstn.UUCP> aad@stpstn.UUCP (Anthony A. Datri) writes: > >I want to write a script that will have multiple links to it, and be >able to tell what name it was invoked with. Ideas? In the Bourne shell ${0} does just fine. Carl Brandauer inhp4!stcvax!nbires!bdaemon!carl
gandalf@csli.STANFORD.EDU (Juergen Wagner) (06/06/88)
Try $0. -- Juergen "Gandalf" Wagner, gandalf@csli.stanford.edu Center for the Study of Language and Information (CSLI), Stanford CA
davidsen@steinmetz.ge.com (William E. Davidsen Jr) (06/07/88)
In article <1813@stpstn.UUCP> aad@stpstn.UUCP (Anthony A. Datri) writes: | | I want to write a script that will have multiple links to it, and be | able to tell what name it was invoked with. Ideas? How about $0? That's the name of the called program. Watch out if you have a full pathname (ie. $0 = foo/something). In that case use a case to strip the leading name, like: case "$0" in foo | */foo) echo "Name is foo";; mumbl | */mumbl) echo "Name is mumbl";; *) echo "Name is wrong!";exit 1;; esac -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me