@silentshdbgsupport@unset _mlshdbg;
@silentshdbgsupport@# disable shell debugging for the run of this init file
@silentshdbgsupport@if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
@silentshdbgsupport@   # immediately disable debugging to echo the less number of line possible
@silentshdbgsupport@   case "$-" in
@silentshdbgsupport@      *v*x*) set +vx; _mlshdbg='vx' ;;
@silentshdbgsupport@      *v*) set +v; _mlshdbg='v' ;;
@silentshdbgsupport@      *x*) set +x; _mlshdbg='x' ;;
@silentshdbgsupport@      *) _mlshdbg='' ;;
@silentshdbgsupport@   esac;
@silentshdbgsupport@fi;
@silentshdbgsupport@
@quarantinesupport@# define modules runtine quarantine configuration
@quarantinesupport@@setquarvars@export MODULES_RUN_QUARANTINE='@RUN_QUARANTINE@'
@quarantinesupport@@setquarvars@@export RUNENV_VAR='RUNENV_VAL'@
@quarantinesupport@@notsetquarvars@#export MODULES_RUN_QUARANTINE='ENVVARNAME'
@quarantinesupport@@notsetquarvars@
@quarantinesupport@# setup quarantine if defined
@quarantinesupport@unset _mlre _mlIFS;
@quarantinesupport@if [ -n "${IFS+x}" ]; then
@quarantinesupport@   _mlIFS=$IFS;
@quarantinesupport@fi;
@quarantinesupport@IFS=' ';
@quarantinesupport@for _mlv in ${MODULES_RUN_QUARANTINE:-}; do
@quarantinesupport@   if [ "${_mlv}" = "${_mlv##*[!A-Za-z0-9_]}" -a "${_mlv}" = "${_mlv#[0-9]}" ]; then
@quarantinesupport@      if [ -n "`eval 'echo ${'$_mlv'+x}'`" ]; then
@quarantinesupport@         _mlre="${_mlre:-}${_mlv}_modquar='`eval 'echo ${'$_mlv'}'`' ";
@quarantinesupport@      fi;
@quarantinesupport@      _mlrv="MODULES_RUNENV_${_mlv}";
@quarantinesupport@      _mlre="${_mlre:-}${_mlv}='`eval 'echo ${'$_mlrv':-}'`' ";
@quarantinesupport@   fi;
@quarantinesupport@done;
@quarantinesupport@if [ -n "${_mlre:-}" ]; then
@quarantinesupport@   _mlre="eval ${_mlre}";
@quarantinesupport@fi;
@quarantinesupport@
# define module command and surrounding initial environment (default value
# for MODULESHOME, MODULEPATH, LOADEDMODULES and parse of init config files)
@quarantinesupport@_mlcode=`${_mlre:-}@TCLSH@ @libexecdir@/modulecmd.tcl bash autoinit`
@notquarantinesupport@_mlcode=`@TCLSH@ @libexecdir@/modulecmd.tcl bash autoinit`
_mlret=$?

@quarantinesupport@# clean temp variables used to setup quarantine
@quarantinesupport@if [ -n "${_mlIFS+x}" ]; then
@quarantinesupport@   IFS=$_mlIFS;
@quarantinesupport@   unset _mlIFS;
@quarantinesupport@else
@quarantinesupport@   unset IFS;
@quarantinesupport@fi;
@quarantinesupport@unset _mlre _mlv _mlrv
@quarantinesupport@
# no environment alteration if the above autoinit command failed
if [ $_mlret -eq 0 ]; then
   eval "$_mlcode"

@compatversion@   # redefine module command if compat version has been activated
@compatversion@   if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@      MODULES_CMD=@libexecdir@/modulecmd-compat
@compatversion@      export MODULES_CMD
@compatversion@      if [ -t 2 ]; then
@compatversion@         _module_raw() { eval `@libexecdir@/modulecmd-compat bash $*`; }
@compatversion@      else
@compatversion@         module() { eval `@libexecdir@/modulecmd-compat bash $*`; }
@compatversion@      fi
@compatversion@   fi
@compatversion@
   # export functions to get them defined in sub-shells
   if [ -t 2 ]; then
      export -f _module_raw
   fi
   export -f module
   if [ "$(type -t ml)" = 'function' ]; then
      export -f ml
   fi

@compatversion@   # define function to switch between C and Tcl versions of Modules
@compatversion@   switchml() {
@compatversion@      typeset swfound=1
@compatversion@      if [ "${MODULES_USE_COMPAT_VERSION:-0}" = '1' ]; then
@compatversion@         typeset swname='main'
@compatversion@         if [ -e @libexecdir@/modulecmd.tcl ]; then
@compatversion@            typeset swfound=0
@compatversion@            unset MODULES_USE_COMPAT_VERSION
@compatversion@         fi
@compatversion@      else
@compatversion@         typeset swname='compatibility'
@compatversion@         if [ -e @libexecdir@/modulecmd-compat ]; then
@compatversion@            typeset swfound=0
@compatversion@            MODULES_USE_COMPAT_VERSION=1
@compatversion@            export MODULES_USE_COMPAT_VERSION
@compatversion@         fi
@compatversion@      fi
@compatversion@
@compatversion@      # switch version only if command found
@compatversion@      if [ $swfound -eq 0 ]; then
@compatversion@         echo "Switching to Modules $swname version"
@compatversion@         source @initdir@/bash
@compatversion@      else
@compatversion@         echo "Cannot switch to Modules $swname version, command not found"
@compatversion@         return 1
@compatversion@      fi
@compatversion@   }
@compatversion@   export -f switchml
@compatversion@
   # enable completion only in interactive mode
   if [ ${BASH_VERSINFO:-0} -ge 3 ] && [[ $- =~ i ]] &&
      [ -r @initdir@/bash_completion ]; then
      source @initdir@/bash_completion
   fi
@setbinpath@
@setbinpath@   if [[ ! ":$PATH:" =~ ':@bindir@:' ]]; then
@setbinpath@@prependbinpath@      PATH=@bindir@${PATH:+:}$PATH
@setbinpath@@appendbinpath@      PATH=$PATH${PATH:+:}@bindir@
@setbinpath@      export PATH
@setbinpath@   fi
@setmanpath@
@setmanpath@   # initialize MANPATH if not set with a value that preserves manpath system
@setmanpath@   # configuration even after addition of paths to this variable by modulefiles
@setmanpath@   if [ ! -n "${MANPATH+x}" ]; then
@setmanpath@      MANPATH=:
@setmanpath@      export MANPATH
@setmanpath@   fi
@setmanpath@@usemanpath@   if [[ ! ":`manpath 2>/dev/null`:" =~ ':@mandir@:' ]]; then
@setmanpath@@notusemanpath@   if [[ ! ":$MANPATH:" =~ ':@mandir@:' ]]; then
@setmanpath@      if [ "$MANPATH" = ':' ] || [ "$MANPATH" = '' ]; then
@setmanpath@         _mlpathsep=''
@setmanpath@      else
@setmanpath@         _mlpathsep=:
@setmanpath@      fi
@setmanpath@@prependmanpath@      MANPATH=@mandir@$_mlpathsep$MANPATH
@setmanpath@@appendmanpath@      MANPATH=$MANPATH$_mlpathsep@mandir@
@setmanpath@      export MANPATH
@setmanpath@      unset _mlpathsep
@setmanpath@   fi
fi

unset _mlcode _mlret
@silentshdbgsupport@
@silentshdbgsupport@# restore shell debugging options if disabled
@silentshdbgsupport@if [ -n "${_mlshdbg:-}" ]; then
@silentshdbgsupport@   set -$_mlshdbg;
@silentshdbgsupport@   unset _mlshdbg;
@silentshdbgsupport@fi;
