Created
August 5, 2015 15:03
-
-
Save ke4roh/505f6049aec09a6f5fb8 to your computer and use it in GitHub Desktop.
Find out where the symbolic links bottom out
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/sh | |
FILE_PATH=$1; | |
while([ -h "${FILE_PATH}" ]) do cd -P $(dirname "${FILE_PATH}"); FILE_PATH=$(readlink "${FILE_PATH}"); done | |
cd -P $(dirname "${FILE_PATH}") > /dev/null | |
echo $(pwd); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment