diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index b2bcbaf6c7cfda834973803f6878232215c66226..a9f2d473a7aabcce134766206f87588d33c9fb36 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -152,7 +152,8 @@ function _spack_pathadd { # Figure out where this file is. Below code needs to be portable to # bash and zsh. # -_sp_source_file="${BASH_SOURCE[0]}" # Bash's location of last sourced file. +_sp_source_dir=$(cd -P $(dirname "${BASH_SOURCE[0]}") && pwd) +_sp_source_file="$_sp_source_dir/$(basename ${BASH_SOURCE[0]})" # Bash's location of last sourced file. if [ -z "$_sp_source_file" ]; then _sp_source_file="$0:A" # zsh way to do it if [[ "$_sp_source_file" == *":A" ]]; then