From a777b1240c6c3be5ff65e902df308c469fb9ba44 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 18 Mar 2015 17:46:18 +0100 Subject: [PATCH] scripts/Bootstrap/Pmodules/modulecmd.in: unset CDPATH added; print message in sub-command 'load' if no module specified --- scripts/Bootstrap/Pmodules/modulecmd.in | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/Bootstrap/Pmodules/modulecmd.in b/scripts/Bootstrap/Pmodules/modulecmd.in index bc47ba7..bb67e02 100755 --- a/scripts/Bootstrap/Pmodules/modulecmd.in +++ b/scripts/Bootstrap/Pmodules/modulecmd.in @@ -1,4 +1,8 @@ #!@PMODULES_HOME@/bin/bash +# + +# we have to unset CDPATH, otherwise 'cd' prints the directoy! +unset CDPATH declare -r PMODULES_DIR=$( cd "$(dirname $0)/.." && pwd ) declare -r version='@PMODULES_VERSION@' @@ -464,6 +468,11 @@ subcommand_generic1plus() { "${modulecmd}" "${shell}" "${subcommand}" "$@" } +# +# load module +# +# $1: module to load +# subcommand_load() { output_load_hints() { local -ra rels=( ${available_releases//:/ } ) @@ -509,7 +518,9 @@ subcommand_load() { } local -r m=$1 - if module_is_available "${m}"; then + if [[ "${m}" == "" ]]; then + echo "No module specified." 1>&2 + elif module_is_available "${m}"; then "${modulecmd}" "${shell}" load "${m}" else if [[ ${userlvl} = 'novice' ]]; then