From 4bc94c519ce11e7ce47c7b4715598a57d66faddd Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 9 Dec 2021 17:52:09 +0100 Subject: [PATCH] modulecmd: use_overlay() improve code for overlays of type replacing --- Pmodules/modulecmd.bash.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 1bc4a78..4e20a23 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1448,18 +1448,18 @@ subcommand_use() { esac if [[ "${ol_type}" == "${ol_replacing}" ]]; then - # if this overlay replaces groups, we have to remove - # the modules made available by other overlays in these groups + # if this overlay replaces groups, we have + # to remove the modules made available by + # other overlays in these groups for group in ${UsedGroups//:/ }; do - # first test whether this group is in the to be added overlay + # is this group in the to be added overlay? local dir="${ol_dir}/" dir+="${group}/${PMODULES_MODULEFILES_DIR}" [[ -d "${dir}" ]] || continue # no - - for dir in "${OverlayList[@]}"; do - dir+="/${group}/${PMODULES_MODULEFILES_DIR}" - std::remove_path MODULEPATH "${dir}" - done + + dir="/${group}/${PMODULES_MODULEFILES_DIR}" + local -a dirs=( "${OverlayList[@]/%/${dir}}" ) + std::remove_path MODULEPATH "${dirs[@]}" done fi