bash script to 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 && "$@"
cd "$(dirname "${BASH_SOURCE[0]}")"
#!/bin/sh
cd "$1" && shift && "$@"