Get reliably the absolute path of currently executed script
CWD="$(
cd "$(dirname "$(readlink "$0" || printf %s "$0")")"
pwd -P
)"
PATH="$CWD:$PATH"
source sibling.sh # source file in the same directory
This works also for linked executables.
Written by Adam Stankiewicz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#