DIR and FILE are actually local vars, so lowercase

Also improve pathfinding to not rely on readlink, and to work as
expected when file is sourced
This commit is contained in:
Kevin van Zonneveld 2014-07-23 11:29:42 +02:00
parent 35b7b8927d
commit 5e492a419c

View File

@ -37,8 +37,8 @@ read -r -d '' usage <<-'EOF'
EOF
# Set magic variables for current FILE & DIR
__FILE__="$(test -L "$0" && readlink "$0" || echo "$0")"
__DIR__="$(cd "$(dirname "${__FILE__}")"; echo $(pwd);)"
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${0}")"
### Functions