From 442a1e23dda6d58933141e445765685e8088749d Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 3 Jul 2023 19:18:33 +0200 Subject: [PATCH] test existence of variable instead of empty string --- Pmodules/modulecmd.bash.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index b453960..026164f 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1026,7 +1026,7 @@ get_available_modules() { # - in same overlay as first found # - new version and not hidden by overlay local name="${mod%/*}" - if [[ -z "${modulenames[${name}]}" ]]; then + if [[ ! -v modulenames[${name}] ]]; then if [[ "${OverlayInfo[${ol}:type]}" == "${ol_hiding}" ]]; then modulenames[${name}]="${ol}" else @@ -1036,7 +1036,7 @@ get_available_modules() { elif [[ "${modulenames[${name}]}" == "${ol}" ]]; then add='yes' elif [[ "${modulenames[${name}]}" == '0' ]] \ - && [[ -z ${dict[${mod}]} ]]; then + && [[ ! -v dict[${mod}] ]]; then add='yes' fi else