Skip to content

Instantly share code, notes, and snippets.

@weissi
Created March 6, 2013 15:42
Show Gist options
  • Save weissi/5100193 to your computer and use it in GitHub Desktop.
Save weissi/5100193 to your computer and use it in GitHub Desktop.
bash: Find Out Script's Containing Directory
# $HERE will contain script's containing directory
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)
#optional
cd "$HERE"
pwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment