From 3d326a527aee094cbf069d5cc09d0873a85ab831 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 29 Oct 2021 12:05:41 +0200 Subject: [PATCH] modulecmd: sort output of sub-command avail numerically --- Pmodules/modulecmd.bash.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index e009069..02d22ab 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -972,6 +972,8 @@ subcommand_avail() { (( n > max_length )) && (( max_length=n )) available_modules+=("${mod}") done + IFS=$'\n' available_modules=($(sort --version-sort <<<"${available_modules[*]}")) + unset IFS local -i span=$(( max_length / 16 + 1 )) # compute column size local -i colsize=$(( span * 16 )) # as multiple of 16 local -i column=$cols # force a line-break