How to issue “module load” in a shell or Perl script (i.e., non-interactively)

余生长醉 提交于 2019-12-06 16:53:06

Start your bash script like this:

#!/bin/bash -l

Note that modules loaded after this with module load xyz will only be available from inside the script file.

Try

source /etc/profile

If that doesn't work, you most likely have a problem with aliases. You may need

shopt -s expand_aliases

in your script.

If by modules you mean Linux kernel modules, look into modprobe (or the more low-level insmod). There's usually no need to use whatever aliases (like module) that your Linux distro loaded into your shell.

(For example, I don't even have a module command on my distro/setup, so I can't try it to see what kind of modules you're referring to.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!