(Tested both with modulecmd 5.3.1 and some very old versions we have
lying around.)
We have an internal tool that requires an environment variable to be
set to a value like:
{"business":"research","chip":"beta","group":"misc"}
complete with all of those those braces, quotes, commas, and colons.
Of course the values of those parameters vary with the project, which is
why I want to set in our modules. I think the string is interpreted by
the tool as perl syntax, but whatever, that's the value needed.
I've found that if I write a module file (for example "projtest") like
this, it works fine for bash users:
#%Module 1.0
setenv PROJECT_NAME \{"business":"research","chip":"beta","group":"misc"\}
I believe the curly braces need to be escaped because they're special
to tcl. With this modulefile, 'module show projtest' at least prints
the expected value for PROJECT_NAME.
But this doesn't work for csh users.
Under csh, running "module load csh" results in $PROJECT_NAME having a value that
is missing the braces and commas:
$ csh -f
% eval ` .../path/to/modulecmd.tcl csh autoinit`
% module clear -f
% module show projtest
-------------------------------------------------------------------
/home/stell/share/modules/projtest:
setenv PROJECT_NAME {"business":"research","chip":"beta","group":"misc"}
-------------------------------------------------------------------
% module load projtest
% echo $PROJECT_NAME
"business":"research" "chip":"beta" "group":"misc"
Note that the curly braces and commas are missing.
I'm not a csh user myself, but I've tried many tweaks to the quoting
generated by module load (modulecmd.tcl procedures renderSettings,
charEscaped, renderFlush, etc). I can't figure out any way to get
modulecmd to set an environment variable to a value containing "{" and
"}".
The only workaround I can find is instructing csh users to run "set
noglob" interactively before executing a "module load" command. But
that doesn't go over well. Nor does suggesting that they switch to
bash :-). Hacking the 'set noglob' into either the output of
`modulecmd.tcl csh load` or the alias set by `modulecmd.tcl csh
autoinit` doesn't work.
Is there any hope for setting environment variable values containing
{braces} with modulecmd, and having that work properly for csh output
as well as the other formats?
Can any csh wizards here provide a usable syntax?
If I find a suggestion that works, I'll have a go at submitting a patch.
thanks,
Steve
|