I’m running a script I just wrote and am getting what looks like a bash function (see below). This is a big nuisance for me and I’d like to turn this “feature?” off but am unable to find out just how to do this. Can you help me please?
Best regards,
George…
ml () { module ml “$@”
}
module () { local _mlredir=1;
if [ -n “${MODULES_REDIRECT_OUTPUT+x}” ]; then
if [ “$MODULES_REDIRECT_OUTPUT” = ‘0’ ]; then
_mlredir=0;
else
if [ “$MODULES_REDIRECT_OUTPUT” = ‘1’ ]; then
_mlredir=1;
fi;
fi;
fi;
case " $@ " in ’ --no-redirect ')
_mlredir=0
;; ’ --redirect ')
_mlredir=1
;;
esac;
if [ $_mlredir -eq 0 ]; then
_module_raw “$@”;
else
_module_raw “$@” 2>&1;
fi
}
_module_raw () { eval “$(/usr/bin/tclsh ‘/usr/share/Modules/libexec/modulecmd.tcl’ bash “$@”)”;
_mlstatus=$?;
return $_mlstatus
}
MANY thanks to all you responders… These are great suggestions…
There was a clue that I missed in the output.
I did a “dnf provides /usr/share/Modules/libexec/modulecmd.tcl” command. The results was “environment-modules”. I did a “dnf remove environment-modules” and the problem went away.
I can’t function without environment-modules — most often used to switch between Fedora’s distro TeX (to have the version others are using) and current CTAN TeX to work on changes to ensure things will work with what others will be using next year. Some scientific software relies on libraries that conflict with Fedora packages so need environment set to find the appropriate libraries.
I don’t see why you got those messages, but they are probably due to
the ml and module functions that are exported by environment-modules in /usr/share/Modules/init/sh loaded from
/etc/profile.d/modules.sh
You can protect your bash script from inheriting functions with this
shebang: #!/bin/bash -p
Excerpt from the bash manual:
-p Turn on privileged mode. In this mode, the shell does
not read the $ENV and $BASH_ENV files, shell functions
are not inherited from the environment, [...]