How to find running script path & its directory in linux ?

SCRIPT=$(readlink -f “$0”)

echo $SCRIPT‘ is the script path.’
SCRIPTPATH=$(dirname “$SCRIPT”)

echo $SCRIPTPATH‘ is the script directory path.’

Leave a comment