run bash script different terminal code example
Example 1: run bash script in its directory
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
Example 2: how to execute a bash script in terminal
$ chmod +x fileName
$ ./fileName
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
$ chmod +x fileName
$ ./fileName