Skip to content

Instantly share code, notes, and snippets.

@ShonFrazier
Created November 18, 2016 20:07
Show Gist options
  • Save ShonFrazier/e254a60967f506029b247df4fbaad2e0 to your computer and use it in GitHub Desktop.
Save ShonFrazier/e254a60967f506029b247df4fbaad2e0 to your computer and use it in GitHub Desktop.
Get the real absolute path behind a symlink
#!/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