2

Get executed script's current working directory

 $ CWD=$(cd "$(dirname "$0")" && pwd)

— by dhsrocha on Jan. 22, 2018, 4:55 p.m.

Explanation

Will return excuting script's current working directory, wherever Bash executes the script containing this line.