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?
views:
787answers:
1
A:
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.
eduffy
2009-07-14 19:19:29
Thanks for the quick response, but something like the below isn't working:adm@mach:~> cat test1.sh#!/bin/bashsource /etc/profileshopt -s expand_aliasesmodule load MySQL#do stuff with mysqladm@mach:~> ./test1.sh./test1.sh: line 6: module: command not found
2009-07-14 19:32:42
<code>adm@mach:~> cat test1.sh#!/bin/bashsource /etc/profileshopt -s expand_aliasesmodule load MySQL#do stuff with mysqladm@mach:~> ./test1.sh./test1.sh: line 6: module: command not found</code>
2009-07-14 19:35:20
What about changing your first line to "/bin/bash -l"?
eduffy
2009-07-14 20:04:20
That worked. Thank you.
2009-07-14 20:09:44