Dcycle Blog

Get the directory where a script resides and where it was called from

November 08, 2015

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P)"
echo $SCRIPTDIR
CALLDIR="$(pwd -P)"
echo $CALLDIR