mirror of
https://github.com/kvz/bash3boilerplate.git
synced 2025-01-19 02:46:23 +00:00
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:
parent
35b7b8927d
commit
5e492a419c
4
main.sh
4
main.sh
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user