From aefdd4a711aff16b719fd2fa2bbfb632fd7a259a Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 6 Jan 2020 15:02:51 +0100 Subject: [PATCH] fix: broken module load with csh --- Pmodules/modulecmd.bash.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 2bac147..b91da3e 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -495,7 +495,6 @@ subcommand_load() { || std::die 1 "Oops: unable to create tmp file!\n" local output=$("${modulecmd}" 'bash' ${opts} 'load' \ "${current_modulefile}" 2> "${tmpfile}") - eval "${output}" # we do not want to print the error message we got from # modulecmd, they are a bit ugly @@ -516,15 +515,18 @@ subcommand_load() { "${error_txt}" \ "${m}" fi - if [[ "${Shell}" == "bash" ]]; then + if [[ "${Shell}" == "sh" ]]; then + # for sh-like shells just echo echo "${output}" - if [[ -n "${error}" ]]; then - echo "${error}" 1>&2 - fi else + # re-run with right shell "${modulecmd}" "${Shell}" ${opts} 'load' \ "${current_modulefile}" fi + eval "${output}" + if [[ -n "${error}" ]]; then + echo "${error}" 1>&2 + fi local msg=$(printf "%s %s: %s -- %s" \ "${CMD}" 'load' \