Last active
June 29, 2016 00:17
-
-
Save hgiesel/7a1a405884b75a003e9f to your computer and use it in GitHub Desktop.
Useful Bash snippets
This file contains hidden or 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
#!/usr/bin/env bash | |
DIR="$(builtin cd "$(dirname "${BASH_SOURCE}" && pwd)" # doesn't actually cd into directory | |
FILE="${DIR}/$(basename "${BASH_SOURCE}")" | |
SYMLINKED_FILE=$(readlink "${FILE}") | |
[[ -n "${SYMLINKED_FILE}" ]] && LIBDIR="$(dirname "${SYMLINKED_FILE}")" || LIBDIR=${DIR} | |
echo "DIR: $DIR" | |
echo "FILE: $FILE" | |
echo "SYMLINKED_FILE: $SYMLINKED_FILE" | |
echo "LIBDIR: $LIBDIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment