Created
November 18, 2016 20:07
-
-
Save ShonFrazier/e254a60967f506029b247df4fbaad2e0 to your computer and use it in GitHub Desktop.
Get the real absolute path behind a symlink
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 | |
realpath() { | |
path=`readlink $0` | |
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" | |
} | |
realpath "$0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment