On Wed, 5 Dec 2001, Harlan Stenn wrote:
> I'm trying to generalize a set of hardcoded, shell-specific aliases
that set
> up some envariables.
>
> I was hoping I could use modules to replace this system, as I'd like to have
> the result support both sh and csh shelltypes.
>
> The current aliases are named like:
>
> {alpha,beta,rel1,rel2}_foo
> {alpha,beta,rel1,rel2}_bar
>
> which sets up the PATH to use the right compilers, updates CLASSPATH, and
> finally does a "cd" to the right directory (alpha, beta, rel1, or rel2) for
> the different copies of either the foo or bar product.
>
> I haven't figured out how to do this with modules yet.
To have the module do a "cd /some/dir" you can do something like
this (I'm not in Tcl mode right now - so this is pseudocode and needs
reworking):
if [module-info mode] == load {
puts stdout ";cd /some/dir;"
}
It should append the "cd" command to the rest of the modulecmd output
which then gets `eval`d.
>
> Any suggestions?
>
You might want to use some sort of redirection. If you look at the
versions approach, I define the env.var. MODULE_VERSION which can
be changed, and is used in the MODULEPATH. The modulecmd will expand
one level env.vars. in MODULEPATH. Also with 3.1.4 (I think) I now have
the modulecmd single quote the commands so env.vars. don't get permanently
interpolated.
You could have modules which are specific to apps!
You might define
CLASSPATH=/some/path/shell-$SHELLTYPE/etc
and then define
SHELLTYPE=[module-info shelltype] # see below
> One idea I had was to have a "visible" module that contained shell-aliases,
> which would invoke a "private" module to do the work of massaging the
> envariables. The problem I'm having with this approach is that I don't see
> how to tell the private module which directory is the target.
>
> Do I have to code shelltype-specific aliases and pass this in via an
> envariable?
Harlan - if you look at module-info modulefile, which is provided by
the distribution it demonstrates a lot of the module-info capabilities.
You can do a test on [module-info shelltype] which gives the generic
shell type (e.g. tcsh,csh -> csh; and sh,bash,zsh,ksh -> sh).
>
> H
>
> (PS - I hope this email comes out OK - I'm forced to use BillWare here and I
> have spent my entire professional career avoiding BillWare.)
>
Good Luck,
R.K.
PS > I've also been able to avoid BillWare much of my professional life
thanks to StarOffice. There must some alternative for the email though!
+------------------+---------------------+
| R.K.Owen,PhD | rk...@ow... |
| KooZ Software | Environment Modules |
| NERSC/LBNL | rk...@ne... |
+------------------+---------------------+
|