Add KSH compat
cherry picked from https://github.com/ansible/ansible/pull/6899
This commit is contained in:
parent
75d3c6b104
commit
7c86db3187
2 changed files with 5 additions and 1 deletions
|
@ -16,6 +16,8 @@ if [ -n "$BASH_SOURCE" ] ; then
|
||||||
HACKING_DIR=$(dirname "$BASH_SOURCE")
|
HACKING_DIR=$(dirname "$BASH_SOURCE")
|
||||||
elif [ $(basename -- "$0") = "env-setup" ]; then
|
elif [ $(basename -- "$0") = "env-setup" ]; then
|
||||||
HACKING_DIR=$(dirname "$0")
|
HACKING_DIR=$(dirname "$0")
|
||||||
|
elif [ -n "$KSH_VERSION" ]; then
|
||||||
|
HACKING_DIR=$(dirname "${.sh.file}")
|
||||||
else
|
else
|
||||||
HACKING_DIR="$PWD/hacking"
|
HACKING_DIR="$PWD/hacking"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -14,8 +14,10 @@ fi
|
||||||
# When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE
|
# When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE
|
||||||
if [ -n "$BASH_SOURCE" ] ; then
|
if [ -n "$BASH_SOURCE" ] ; then
|
||||||
HACKING_DIR=$(dirname "$BASH_SOURCE")
|
HACKING_DIR=$(dirname "$BASH_SOURCE")
|
||||||
elif [ $(basename "$0") = "env-setup" ]; then
|
elif [ $(basename -- "$0") = "env-setup" ]; then
|
||||||
HACKING_DIR=$(dirname "$0")
|
HACKING_DIR=$(dirname "$0")
|
||||||
|
elif [ -n "$KSH_VERSION" ]; then
|
||||||
|
HACKING_DIR=$(dirname "${.sh.file}")
|
||||||
else
|
else
|
||||||
HACKING_DIR="$PWD/hacking"
|
HACKING_DIR="$PWD/hacking"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue