Skip to content

Instantly share code, notes, and snippets.

@ke4roh
Created August 5, 2015 15:03
Show Gist options
  • Save ke4roh/505f6049aec09a6f5fb8 to your computer and use it in GitHub Desktop.
Save ke4roh/505f6049aec09a6f5fb8 to your computer and use it in GitHub Desktop.
Find out where the symbolic links bottom out
#!/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