Commit 7c86db31 by Toshio Kuratomi

Add KSH compat

cherry picked from https://github.com/ansible/ansible/pull/6899
parent 75d3c6b1
...@@ -16,6 +16,8 @@ if [ -n "$BASH_SOURCE" ] ; then ...@@ -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 ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment