You can obtain the directory where a Bash script is located from within the script itself by using the $0 parameter, which contains the path to the script that is currently running, and the dirname command, which extracts the directory portion of the path.
Continue Reading...