Created
June 23, 2016 16:22
-
-
Save bgromov/93da2ff0d2b095571fa15eb0baefdce9 to your computer and use it in GitHub Desktop.
One-liner to determine scripts own location. No matter where it is called from. (Doesn't work with symlinks)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Credits: http://stackoverflow.com/a/246128 | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
echo "Where am I?!" | |
echo -e "I am here: ${DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment