CodyKochmann
6/5/2017 - 3:12 PM

Get the full path (or BASEDIR) of the running script's path in bash. Put this at the top of every bash script so you never get lost.

Get the full path (or BASEDIR) of the running script's path in bash. Put this at the top of every bash script so you never get lost.

BASEDIR=$( cd -P "$(dirname "$0")" && pwd)
popd "${BASEDIR}" || exit 1