Skip to content

Instantly share code, notes, and snippets.

@raskasa
Created May 3, 2018 00:44
Show Gist options
  • Save raskasa/17ea4fd131bb1c755dabd97b2ba1c562 to your computer and use it in GitHub Desktop.
Save raskasa/17ea4fd131bb1c755dabd97b2ba1c562 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# 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