From 23b4c37bc796d8bf9000c85af1aeefa7c28db7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Achim=20Gsell=C3=BC?= Date: Fri, 14 Sep 2018 16:59:45 +0200 Subject: [PATCH] Pmodules/modulecmd.bash.in - bugfix in subcommand_load(): LOADEDMODULES were not set correct: the output of "modulecmd ... --- Pmodules/modulecmd.bash.in | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index fcbee0a..a4daf54 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -816,7 +816,9 @@ subcommand_load() { fi local -r tmpfile=$( "${mktemp}" /tmp/Pmodules.XXXXXX ) \ || std::die 1 "Oops: unable to create tmp file!" - "${modulecmd}" "${shell}" ${opts} load "${current_modulefile}" 2> "${tmpfile}" + local output=$("${modulecmd}" "${shell}" ${opts} load "${current_modulefile}" 2> "${tmpfile}") + echo "${output}" + eval "${output}" error=$( < "${tmpfile}") if [[ -n "${error}" ]]; then echo "${error}" 1>&2 @@ -825,18 +827,13 @@ subcommand_load() { if [[ ${verbosity_lvl} != silent ]] && [[ ${release} != stable ]]; then std::info "Warning: the ${release} module '${m}' has been loaded." fi - if [[ -z "${_LMFILES_}" ]]; then - _LMFILES_="${current_modulefile}" - else - _LMFILES_+=":${current_modulefile}" - fi done # fix LOADEDMODULES LOADEDMODULES="${_LMFILES_}" - for dir in "${modulepath[@]}"; do + while read dir; do [[ "${dir: -1}" == "/" ]] || dir+="/" LOADEDMODULES="${LOADEDMODULES//${dir}}" - done + done <<< "${MODULEPATH//:/$'\n'}" pbuild::export_env "${g_shell}" LOADEDMODULES }