Friday, December 23, 2011

Bash script can tell its location

You can get the path of the directory in which a bash script is located FROM that bash script.

dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
view raw gistfile1.txt hosted with ❤ by GitHub

Read more about this problem on stackoverflow.

1 comment: