summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2019-07-12 08:33:23 -0700
committerGitHub <noreply@github.com>2019-07-12 08:33:23 -0700
commite8e030a518f3894d5be228401110b9c6cc5ff76e (patch)
tree12d45c2a3ec4efb94c1b8aae3d4acb7a19d03c8c /share
parent91e35541ee9a87f588988a9dc7eadbc65e74d106 (diff)
downloadspack-e8e030a518f3894d5be228401110b9c6cc5ff76e.tar.gz
spack-e8e030a518f3894d5be228401110b9c6cc5ff76e.tar.bz2
spack-e8e030a518f3894d5be228401110b9c6cc5ff76e.tar.xz
spack-e8e030a518f3894d5be228401110b9c6cc5ff76e.zip
bugfix: setup-env.sh detects bash even when bash is run as sh (#11994)
- `setup-env.sh` was not properly detecting a bash shell when bash was run as /bin/sh. - Detection routine now always reports bash when bash is run as sh, and no longer parses the path to the executable indicated in `$BASH`.
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/setup-env.sh9
1 files changed, 2 insertions, 7 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index e0161f21a2..9425d0b379 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -233,15 +233,10 @@ _spack_pathadd() {
# Determine which shell is being used
#
_spack_determine_shell() {
- # This logic is derived from the cea-hpc/modules profile.sh example at
- # https://github.com/cea-hpc/modules/blob/master/init/profile.sh.in
- #
- # The objective is to correctly detect the shell type even when setup-env
- # is sourced within a script itself rather than a login terminal.
if [ -n "${BASH:-}" ]; then
- echo ${BASH##*/}
+ echo bash
elif [ -n "${ZSH_NAME:-}" ]; then
- echo $ZSH_NAME
+ echo zsh
else
PS_FORMAT= ps -p $$ | tail -n 1 | awk '{print $4}' | sed 's/^-//' | xargs basename
fi