Skip to content

Instantly share code, notes, and snippets.

@raskasa
Created August 31, 2019 23:57
Show Gist options
  • Save raskasa/7026985a386c3c9974e45a8224dbb648 to your computer and use it in GitHub Desktop.
Save raskasa/7026985a386c3c9974e45a8224dbb648 to your computer and use it in GitHub Desktop.
# Store the full directory name of the executing script, no matter where it is
# being called from. This will work as long as the last component of the path
# used to find the script is not a symlink; directory links are OK.
# SEE: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo ${DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment