/usr/share/lmod/6.6/init/bash is in lmod 6.6-0.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | #!/bin/bash
# -*- shell-script -*-
if [[ ${-/x} != $- ]]; then
echo "Start of Lmod init/bash script to define the module command"
fi
LMOD_PKG=/usr/share/lmod/lmod
LMOD_DIR=/usr/share/lmod/lmod/libexec
LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
MODULESHOME=/usr/share/lmod/lmod
export LMOD_PKG
export LMOD_CMD
export LMOD_DIR
export MODULESHOME
########################################################################
# Define the module command: The first line runs the "lmod" command
# to generate text:
# export PATH="..."
# then the "eval" converts the text into changes in the current shell.
#
# The second command is the settarg command. Normally LMOD_SETTARG_CMD
# is undefined or is ":". Either way the eval does nothing. When the
# settarg module is loaded, it defines LMOD_SETTARG_CMD. The settarg
# command knows how to read the ModuleTable that Lmod maintains and
# generates a series of env. vars that describe the current state of
# loaded modules. So if one is on a x86_64 linux computer with gcc/4.7.2
# and openmpi/1.6.3 loaded, then settarg will assign:
#
# TARG=_x86_64_gcc-4.7.2_openmpi-1.6.3
# TARG_COMPILER=gcc-4.7.2
# TARG_COMPILER_FAMILY=gcc
# TARG_MACH=x86_64
# TARG_MPI=openmpi-1.6.3
# TARG_MPI_FAMILY=openmpi
# TARG_SUMMARY=x86_64_gcc-4.7.2_openmpi-1.6.3
# TARG_TITLE_BAR=gcc-4.7.2 O-1.6.3
# TARG_TITLE_BAR_PAREN=(gcc-4.7.2 O-1.6.3)
#
# unloading openmpi/1.6.3 automatically changes these vars to be:
#
# TARG=_x86_64_gcc-4.6.3
# TARG_COMPILER=gcc-4.6.3
# TARG_COMPILER_FAMILY=gcc
# TARG_MACH=x86_64
# TARG_SUMMARY=x86_64_gcc-4.6.3
# TARG_TITLE_BAR=gcc-4.6.3
# TARG_TITLE_BAR_PAREN=(gcc-4.6.3)
#
# See Lmod web site for more details.
module()
{
eval $($LMOD_CMD bash "$@")
[ $? = 0 ] && eval $(${LMOD_SETTARG_CMD:-:} -s sh)
}
LMOD_VERSION="6.6"
export LMOD_VERSION
if [ "${LMOD_SETTARG_CMD:-:}" != ":" ]; then
settarg () {
eval $(${LMOD_SETTARG_CMD:-:} -s sh "$@" )
}
fi
########################################################################
# ml is a shorthand tool for people who can't type moduel, err, module
# It is also a combination command:
# ml -> module list
# ml gcc -> module load gcc
# ml -gcc intel -> module unload gcc; module load intel
# It does much more do: "ml --help" for more information.
unalias ml 2> /dev/null || true
ml()
{
eval $($LMOD_DIR/ml_cmd "$@")
}
export_module=$(echo "YES" | /usr/bin/tr '[:upper:]' '[:lower:]')
if [ -n "${BASH_VERSION:-}" -a "$export_module" != no ]; then
export -f module
export -f ml
fi
unset export_module
########################################################################
# clearMT removes the ModuleTable from your environment. It is rarely
# needed but it useful sometimes.
clearMT()
{
eval $($LMOD_DIR/clearMT_cmd bash)
}
########################################################################
# The following make the action of the settarg available to the titlebar
# for both xterm's and screen but only for interactive shells.
if [ -n "${PS1:-}" ]; then
if [ -n "${LMOD_FULL_SETTARG_SUPPORT:-}" -a "$LMOD_FULL_SETTARG_SUPPORT" != no ]; then
xSetTitleLmod()
{
builtin echo -n -e "\033]2;$1\007";
}
SET_TITLE_BAR=:
case "$TERM" in
xterm*)
SET_TITLE_BAR=xSetTitleLmod
;;
esac
SHOST=${SHOST-${HOSTNAME%%.*}}
precmd()
{
eval $(${LMOD_SETTARG_CMD:-:} -s bash)
${SET_TITLE_BAR:-:} "${TARG_TITLE_BAR_PAREN}${USER}@${SHOST}:${PWD/#$HOME/~}"
${USER_PROMPT_CMD:-:}
}
# define the PROMPT_COMMAND to be precmd iff it isn't defined already.
: ${PROMPT_COMMAND:=precmd}
fi
fi
########################################################################
# Make tab completions available to bash users.
if [ ${BASH_VERSINFO:-0} -ge 3 ] && [ -r /usr/share/lmod/lmod/init/lmod_bash_completions ] && [ -n "${PS1:-}" ]; then
. /usr/share/lmod/lmod/init/lmod_bash_completions
fi
if [[ ${-/x} != $- ]]; then
echo "End of Lmod init/bash script to define the module command"
fi
# Local Variables:
# mode: shell-script
# indent-tabs-mode: nil
# End:
|