From 50c9b6d692d8ba6ae35520705856aeae632ed3e3 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 17 Sep 2021 15:32:56 +0200 Subject: [PATCH] modulecmd: fix output of module avail - for directories outside the hierarchy the header did not include the directory name. --- Pmodules/modulecmd.bash.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index fc51ad6..3382b36 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1042,8 +1042,12 @@ subcommand_avail() { local string for string in "${pattern[@]}"; do for dir in "${modulepath[@]}"; do - local group="${dir/${PMODULES_ROOT}\/}" - group="${group%%/*}" + if [[ ${dir} =~ ${PMODULES_ROOT} ]]; then + local group="${dir/${PMODULES_ROOT}\/}" + group="${group%%/*}" + else + local group="${dir}" + fi if (( ${#opt_groups[@]} > 0 )) && [[ ! -v opt_groups[${group}] ]]; then continue fi