Reputation:
I can use the "module load xyz" command interactively, but when run from a script, it says it can't find the "module" command. Is there any way of loading modules in a script?
Upvotes: 2
Views: 16353
Reputation: 159
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.
Upvotes: 4
Reputation: 770
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.)
Upvotes: -1
Reputation: 40252
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.
Upvotes: 1