Unix shell script find out which directory the script file resides? September 9, 2022 by Tarik In Bash, you should get what you need like this: #!/usr/bin/env bash BASEDIR=$(dirname "$0") echo "$BASEDIR"