Get the path of the script
ref: https://developpaper.com/bash-tips-01-get-the-scripts-own-path/ my_path = $ ( cd $ ( dirname "BASH_SOURCE[0]" ) && pwd ) https://www.ostricher.com/2014/10/the-right-way-to-get-the-directory-of-a-bash-script/ itamar@legolas ~ $ cat foo.sh echo "$0" SCRIPT_DIR= "$( cd " $( dirname "$0" ) " && pwd )" echo "$SCRIPT_DIR" itamar@legolas ~ $ . /foo .sh . /foo .sh /Users/itamar itamar@legolas ~ $ cd foobar/ itamar@legolas foobar $ ./.. /foo .sh ./.. /foo .sh /Users/itamar