Write a module file

A module files are written using TCL (Tool Command Language) and is interpreted by modulecmd.tcl.

A simple example of module file which adds a path to environment variable PATH.

#%Module1.0

proc ModulesHelp {} {
    puts stderr "This is a simple module file"
}

module-whatis "This is a simple module file prepending a path."

set path "/home/nitin/bin"

prepend-path PATH $path

Let’s say it resides at /home/nitin/modulefiles/test and to use it, we need to make this path available for module.

module use /home/nitin/modulefiles

This should add the path for module files. module avail should show new added modules.

nitin@workstation ~> module avail

------------------------ /home/nitin/modulefiles ---------------------
test

------------------------ /usr/share/modules/modulefiles --------------
dot  module-git  module-info  modules  null  use.own

Key:
modulepath

We can load the module using,

module load test

It should prepend /home/nitin/bin to PATH.