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