Created
December 5, 2012 04:27
-
-
Save keepzero/4212234 to your computer and use it in GitHub Desktop.
Get absolute path of this script
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 | |
# basename - strip directory and suffix from filenames | |
# dirname - strip last component from file name | |
ABSDIR=$(cd $(dirname "$0") > /dev/null; pwd) | |
ABSPATH=$(cd $(dirname "$0") > /dev/null; pwd)/$(basename $0) | |
echo $ABSDIR | |
echo $ABSPATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's so ugly. But work fine.