Since Modules v4, unloading a given module name unloads lastly loaded module matching this given name. On Modules v3 the module selected for the unload was the firstly loaded not the lastly loaded. This recipe gives a way to restore the behavior of the v3 version.
A site-specific configuration script is proposed to select firstly loaded module matching name rather lastly loaded.
../../example/unload-firstly-loaded/siteconfig.tcl
Compatible with Modules v4.2
Create site-specific configuration directory if it does not exist yet:
$ mkdir
Then copy there the site-specific configuration script of this recipe:
$ cp example/unload-firstly-loaded/siteconfig.tcl /
With a bare foo/1
modulefile:
../../example/unload-firstly-loaded/modulefiles/foo/1
And a bare foo/2
modulefile:
../../example/unload-firstly-loaded/modulefiles/foo/2
Enable the modulepath where the example modulefiles are located:
$ module use example/unload-firstly-loaded/modulefiles
Load both foo
modulefiles then attempt to unload foo
name:
$ module load foo/1 foo/2
$ module list
Currently Loaded Modulefiles:
1) foo/1 2) foo/2
$ module unload foo
$ module list
Currently Loaded Modulefiles:
1) foo/2