Where is the Bash Script Running?

Sometimes it’s necessary to figure out where the current bash script is running. Just use the $0 parameter.

command comment
echo `dirname $0` The directory in which the script is running.
echo `basename $0` The name of the script itself (w/o it directory).

bash

43 Words

2010-08-06 20:02 +0000