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

catamount picture catamount · Jul 14, 2009 · Viewed 15.1k times · Source

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?

Answer

zega picture zega · Nov 28, 2012

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.