Shell detection syntax fixed
This commit is contained in:
parent
681ff45134
commit
63997d2285
|
@ -5,7 +5,7 @@
|
||||||
# SC1090 Can't follow non-constant source
|
# SC1090 Can't follow non-constant source
|
||||||
|
|
||||||
# User basename instead of ${0:##*/} to be POSIX compliant
|
# User basename instead of ${0:##*/} to be POSIX compliant
|
||||||
BASE_0=${BASE_0:-$(basename $0)}
|
BASE_0=${BASE_0:-$(basename ${0#-})}
|
||||||
SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"}
|
SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"}
|
||||||
BASE_SHELL=$(basename "$SHELL")
|
BASE_SHELL=$(basename "$SHELL")
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ is_sourced() {
|
||||||
case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac
|
case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac
|
||||||
else
|
else
|
||||||
# case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac
|
# case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac
|
||||||
case "$(basename $0)" in $BASE_SHELL|-$BASE_SHELL) return 0;; esac
|
case "${BASE_0}" in $BASE_SHELL|-$BASE_SHELL) return 0;; esac
|
||||||
fi
|
fi
|
||||||
return 1; # NOT sourced.
|
return 1; # NOT sourced.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue