Created
December 14, 2012 21:07
-
-
Save taylor/4288688 to your computer and use it in GitHub Desktop.
Find the name of the shell script, de-reference symlinks, handle both SOURCED scripts and executed versions.
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
#!/bin/bash | |
[[ "$0" = "-bash" ]] && N="$BASH_SOURCE" || N="$0" | |
me=$(basename `readlink --canonicalize --no-newline $N`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Slick