Skip to content

Instantly share code, notes, and snippets.

@codfish
Created August 8, 2014 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codfish/a96b5861aebad8101414 to your computer and use it in GitHub Desktop.
Save codfish/a96b5861aebad8101414 to your computer and use it in GitHub Desktop.
Get the directory in bash of the script that's running. It's a useful one-liner which will give you the full directory name of the script no matter where it is being called from.
# source: http://stackoverflow.com/a/246128
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment