Add KSH compat

cherry picked from https://github.com/ansible/ansible/pull/6899
This commit is contained in:
Toshio Kuratomi 2015-02-09 15:37:35 -08:00
parent 75d3c6b104
commit 7c86db3187
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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