From f57559e4e24b8f33ada2844913f29acd6366b951 Mon Sep 17 00:00:00 2001 From: Matthew Scott Krafczyk Date: Sun, 10 Sep 2017 21:54:23 -0500 Subject: Fix two bugs from the bootstrap update (#5312) These were discovered with bash 4.1.2. Add quotations around a variable to prevent the destruction of a newline. Without this fix a conditional doesn't work properly. Remove square brackets around a conditional meant to be evaluated based on the return code of a command. This wasn't working properly with an old bash. Fix a typo. --- share/spack/setup-env.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'share') diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index 958689cab4..8cf54661d8 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -207,14 +207,14 @@ function _spack_determine_shell() { export SPACK_SHELL=$(_spack_determine_shell) # -# Check whether a shell function of the given name is defined +# Check whether a function of the given name is defined # function _spack_fn_exists() { - type $1 2>&1 | grep -q 'shell function' + type $1 2>&1 | grep -q 'function' } need_module="no" -if [ ! $(_spack_fn_exists use) ] && [ ! $(_spack_fn_exists module) ]; then +if ! _spack_fn_exists use && ! _spack_fn_exists module; then need_module="yes" fi; @@ -222,9 +222,9 @@ fi; # build and make available environment-modules # if [ "${need_module}" = "yes" ]; then - #check if environment-modules~X is installed + #check if environment-modules is installed module_prefix="$(spack location -i "environment-modules" 2>&1 || echo "not_installed")" - module_prefix=$(echo ${module_prefix} | tail -n 1) + module_prefix=$(echo "${module_prefix}" | tail -n 1) if [ "${module_prefix}" != "not_installed" ]; then #activate it! export MODULE_PREFIX=${module_prefix} @@ -235,7 +235,7 @@ if [ "${need_module}" = "yes" ]; then echo "WARNING: A method for managing modules does not currently exist." echo "" echo "To resolve this you may either:" - echo "1. Allow spack to handle this by running 'spack boostrap'" + echo "1. Allow spack to handle this by running 'spack bootstrap'" echo " and sourcing this script again." echo "2. Install and activate a supported module managment engine manually" echo " Supported engines include: environment-modules and lmod" -- cgit v1.2.3-70-g09d2