$ cat test.sh echo "\$0 is $0" $ bash test.sh $0 is test.sh $ source ./test.sh $0 is bash
sobota, 13 lutego 2016
When a script is run from a command line then the 0th parameter is the script's name. However, when a script is run via source command, then the 0th parameter is a shell name. Weird, but true.