shell script change directory code example
Example 1: bash change to script directory
cd "$(dirname "${BASH_SOURCE[0]}")"
Example 2: bash script change directory run a command
#!/bin/sh
cd "$1" && shift && "$@"
Example 3: bash script change directory run a command
cd DIRECTORY_HERE; COMMAND_WITH_ARGS_HERE