Here's more.
We're writing scripts that want to call "commands" that are defined
by modulefiles.
We noticed that sometimes these scripts worked, and sometimes they
didn't.
I have just discovered that these scripts fail when they are called
by other scripts (as opposed from being invoked from the command
line) and this seems to be due to the fact that:
- we're writing the scripts ASSUMING that the modules stuff is available
- - this has been true for us because we use shells that run startup (RC)
scripts on each shell invocation
- in performing some cleanup we are apparently making some changes that
mean that sometimes we don't run the entire suite of RC scripts
- this means that in some cases where scripts call scripts that the
shell aliases created by the modules RC stuff are not being created
I figure there are two ways to proceed:
- be VERY careful when writing scripts to make sure we source in a
suitable "modules init" function that also does our "loads"
- make sure we have per-shell (for *all* useful shells) RC files
that handle the modules init and our "loads"
The first choice seems to be a bit better in that we'll only be doing the
modules setup on those scripts where we need them. The downside of this
method is that scripts will break until we find all of these cases.
The second choice is less efficient (as there are going to be lots of
times where we won't be using modules but we have to do the work
anyway), but it has the benefit of putting the burden in a single place.
Does this make sense?
H
-----Original Message-----
From: Harlan Stenn
Sent: Friday, January 11, 2002 7:05 PM
To: Modules-Interest (E-mail)
Subject: shell scripts that need "modules" stuff
So what's the right way to write shell (for arbitrary versions of shell)
script
that include "commands" and things that are defined by the modules stuff?
Does each script that needs to do this have to source in
$MODULESHOME/init/$SHELL
(or something similar)?
H
|