Quick Tip — Written on
Get the location of the bash script
Sometimes you want to know the scripts path to include other scripts, templates or other stuff. This seems to be a reliable way -- for me.
#!/bin/sh
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
Source: StackOverflow thread