简体   繁体   English

如何在加载模块时获取环境模块模块文件以打印消息?

[英]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.我刚刚学会了如何使基本modulefiles加载软件我的集群上。 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?其他环境模块(由管理员创建)在加载时打印一条消息: $ module load Name Welcome to Name/version.1.2.3如何将其添加到模块文件中? 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).我从手册页(ex module-info name )中尝试了一些东西,但没有运气(或者我做错了)。

Thanks谢谢

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

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

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:如果您“只”希望在运行module load时打印消息(而不是在运行module unload或其他命令时),那么您可以使用如下语句:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM