notes

Bash Commands

Get full directory name

dirname $(readlink -f "$0")

Output

$ /path/to/dir/script.sh
/path/to/dir

Get script name

basename $(readlink -f "$0")

Output

$ /path/to/dir/script.sh
script.sh