run bash script from different directory code example
Example 1: run bash script in its directory
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
Example 2: bash script change directory run a command
cd DIRECTORY_HERE; COMMAND_WITH_ARGS_HERE
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
cd DIRECTORY_HERE; COMMAND_WITH_ARGS_HERE