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

时间:2016-02-12 20:56:14

标签: linux environment-modules

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: strid = rowview.Row["Id"].ToString(); 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 load Name Welcome to Name/version.1.2.3 ) but no luck (or I'm doing it wrong).

Thanks

2 个答案:

答案 0 :(得分:1)

您可以将puts stderr语句添加到modulefile,以便将消息打印到终端。

puts stderr "** INFO: 'Welcome, Module loaded'"

答案 1 :(得分:0)

如果您“仅”希望在运行module load时打印消息(而不是在运行module unload或其他命令时打印),则可以使用如下语句:

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

参考:https://sourceforge.net/p/modules/mailman/message/34597600/