summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2016-04-28 15:49:38 -0700
committerbecker33 <becker33@llnl.gov>2016-04-28 15:49:38 -0700
commit3c10e3b502520158a91258920eb6d935ea5de51a (patch)
tree25e437251e7c9602d43388a735a55cb7b65b1d21 /share
parent1b731e525f42f2c90f82ab442867a28168d44db5 (diff)
parent10d8ed4d98314f298c5fd28d726834129510fbd5 (diff)
downloadspack-3c10e3b502520158a91258920eb6d935ea5de51a.tar.gz
spack-3c10e3b502520158a91258920eb6d935ea5de51a.tar.bz2
spack-3c10e3b502520158a91258920eb6d935ea5de51a.tar.xz
spack-3c10e3b502520158a91258920eb6d935ea5de51a.zip
Merge pull request #861 from trws/cd-fix
check that a target directory exists before committing to cd
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/setup-env.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 764af68400..e3dd1cb4b9 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -1,4 +1,4 @@
-##############################################################################
+#####################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
@@ -84,7 +84,10 @@ function spack {
if [ "$_sp_arg" = "-h" ]; then
command spack cd -h
else
- cd $(spack location $_sp_arg "$@")
+ LOC="$(spack location $_sp_arg "$@")"
+ if [[ "x" -ne "x$LOC" ]] ; then
+ cd "$LOC"
+ fi
fi
return
;;