Module and SoftEnv

Module vs. SoftEnv

SoftEnv, created by Remy Evard, is a tool for creating and managing a UNIX user's environment from a list of desired packages.

Module, created by John Furlani, achieves pretty much the same thing.

Usually the packages in SoftEnv are named +name-version or @name-version, and in Module, name/version

Operation Module command SoftEnv command
Load a package
into user's environment
module add pkg soft add pkg (to prepend to $PATH)

soft append pkg (to append to $PATH)

Remove a package
from user's environment
module rm pkg soft delete pkg
List all available packages module avail softenv
List loaded packages
in user's environment
module list
echo $LOADEDMODULES
Show the environment changes
made by loading a package
module display pkg soft-dbq pkg
Reset the user's environment module purge resoft

To use SoftEnv in shell scripts

In Bourne shell (bash, sh), to add package +foo:
eval `soft-dec -d sh add +foo`
To remove package +foo:
eval `soft-dec -d sh delete +foo`
For C shell (csh, tcsh), replace above sh by csh

To use Module in shell/Perl scripts

First, one needs to initialize the Module environment. In Bourne shell (bash, sh),
. ${MODULESHOME}/init/sh
In C shell (csh, tcsh),
source ${MODULESHOME}/init/csh
Then one can use the commands like module add as usual in the shell scripts.

For Perl,

require "${MODULESHOME}/init/perl";
&module("load pkg1 pkg2");

Module is implemented as a user-defined function or an alias. For example, in Bourne shell, it is a user-defined function which uses eval to change environmental variables:

$ declare -f module

module () 
{ 
    eval `/util/Modules/$MODULE_VERSION/bin/modulecmd bash $*`
}
It uses the environmental variable LOADEDMODULES to keep track of loaded modules.