diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 55532a3..5eb3cb1 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -715,6 +715,9 @@ subcommand_load() { LOADEDMODULES="${_LMFILES_}" local dir while read dir; do + # if the first or last character of MODULEPATH is ':', + # we read an empty string. + [[ -z ${dir} ]] && continue [[ "${dir: -1}" == "/" ]] || dir+="/" LOADEDMODULES="${LOADEDMODULES//${dir}}" map_moduledir2ol_name overlay "${dir}"