diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index d5cad059a618dc43cf6a3a86ada390d3aead331d..ab2655ddf6ecda97d2bf30cf947b7d8c1fa5edd1 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -215,11 +215,14 @@ _spack_pathadd() {
 }
 
 
-#
 # Determine which shell is being used
-#
 _spack_determine_shell() {
-    if [ -n "${BASH:-}" ]; then
+    if [ -f "/proc/$$/exe" ]; then
+        # If procfs is present this seems a more reliable
+        # way to detect the current shell
+        _sp_exe=$(readlink /proc/$$/exe)
+        basename ${_sp_exe}
+    elif [ -n "${BASH:-}" ]; then
         echo bash
     elif [ -n "${ZSH_NAME:-}" ]; then
         echo zsh