linuxenvironment-modules

How to get an Environment Module modulefile to print a message upon loading the module?


I've just learned the basics on how to make modulefiles for loading software on my cluster. Other environment modules (created by admins) print a message upon loading: $ module load Name Welcome to Name/version.1.2.3 How do I add this to the modulefile? I like the quick confirmation that I've indeed loaded the module I intended. I've tried a few things from the man page (ex module-info name) but no luck (or I'm doing it wrong).

Thanks


Solution

  • If you "only" want the message to print when running module load (but not when running module unload or other commands), then you can use a statement like this:

    if [ module-info mode load ] {
        puts stderr "your text here"
    }
    

    Reference: https://sourceforge.net/p/modules/mailman/message/34597600/