This snippet detects various information about the shell script in which it is being executed. Copy and paste it into the top of your script.
Variables set are as follows:
trueif the file was invoked using
. filename, otherwise it will be blank.
$__SCRIPT_PATH: the full absolute path to the script.
$__SCRIPT_DIR: the full absolute path to the script's directory.