1 SOURCE="${BASH_SOURCE[0]}" 2 BIN_DIR="$( dirname "$SOURCE" )" 3 while [ -h "$SOURCE" ] 4 do 5 SOURCE="$(readlink "$SOURCE")" 6 [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 7 BIN_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 8 done 9 BIN_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 10 LIB_DIR=$BIN_DIR/../lib