From 622d4c7720e01ae15827cf4b073538ea8faa29bc Mon Sep 17 00:00:00 2001 From: gsell Date: Thu, 17 Jul 2025 13:26:34 +0200 Subject: [PATCH] modulecmd: review code to search modules --- Pmodules/modulecmd.bash.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index cc67bbc..ff13aa4 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -791,18 +791,20 @@ subcommand_load() { # get_load_hints() { local -n output="$1" # [out] ref.var to return result - local relstage='' output='' + + local -- search_result="$(set +x; subcommand_search "${m}" -a --no-header 2>&1)" + local -- relstage='' while read -r -a line; do - (( ${#line[@]} == 0 )) && continue - relstage=${line[1]} + (( ${#line[@]} == 0 )) && continue + relstage="${line[1]}" if [[ ! ":${UsedReleaseStages}:" == *:${relstage}:* ]]; then output+="module use ${relstage}; " fi local group=${line[2]} #echo "group=${group}" 1>&2 [[ "${group}" != 'none' ]] || continue - if [[ ! ":${UsedGroups}:" == *:${group}:* ]] && \ + if [[ ! ":${UsedGroups}:" == *:${group}:* ]] && \ (( ${GroupDepths[${group}]} == 0 )); then output+="module use ${group}; " fi