From 7c86db31876b9299016e139dd98dc524139e3e25 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 9 Feb 2015 15:37:35 -0800 Subject: [PATCH] Add KSH compat cherry picked from https://github.com/ansible/ansible/pull/6899 --- hacking/env-setup | 2 ++ v2/hacking/env-setup | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hacking/env-setup b/hacking/env-setup index 10adad50995..9b9a529d13a 100644 --- a/hacking/env-setup +++ b/hacking/env-setup @@ -16,6 +16,8 @@ if [ -n "$BASH_SOURCE" ] ; then HACKING_DIR=$(dirname "$BASH_SOURCE") elif [ $(basename -- "$0") = "env-setup" ]; then HACKING_DIR=$(dirname "$0") +elif [ -n "$KSH_VERSION" ]; then + HACKING_DIR=$(dirname "${.sh.file}") else HACKING_DIR="$PWD/hacking" fi diff --git a/v2/hacking/env-setup b/v2/hacking/env-setup index c573a56878f..fed8e892fda 100644 --- a/v2/hacking/env-setup +++ b/v2/hacking/env-setup @@ -14,8 +14,10 @@ fi # When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE if [ -n "$BASH_SOURCE" ] ; then HACKING_DIR=$(dirname "$BASH_SOURCE") -elif [ $(basename "$0") = "env-setup" ]; then +elif [ $(basename -- "$0") = "env-setup" ]; then HACKING_DIR=$(dirname "$0") +elif [ -n "$KSH_VERSION" ]; then + HACKING_DIR=$(dirname "${.sh.file}") else HACKING_DIR="$PWD/hacking" fi