hlzghw
Last Updated: February 25, 2016
·
1.281K
· sheerun
Photo on 08.01.2013 at 04.15

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.