bash - Get path of current script when executed through a symlink - Unix & Linux Stack Exchange
Try this as a general purpose solution:
DIR="$(cd "$(dirname "$0")" && pwd)"
In the specific case of following symlinks, you could also do this:
DIR="$(dirname "$(readlink -f "$0")")"
Read full article from bash - Get path of current script when executed through a symlink - Unix & Linux Stack Exchange
No comments:
Post a Comment