how to cd into location of shell script code example Example: bash change to script directory cd "$(dirname "${BASH_SOURCE[0]}")"