From 9bb1f1c1b54e00cc8a212eb52765a67ca9f9437d Mon Sep 17 00:00:00 2001 From: Malcolm Cook Date: Wed, 13 May 2015 11:40:41 -0500 Subject: [PATCH] fix #32: share/spack/setup-env.sh fails when executed indirectly fix github #32: share/spack/setup-env.sh fails when executed indirectly from a symlink --- share/spack/setup-env.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index b2bcbaf6c7cfd..a9f2d473a7aab 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