Thanks, Jesse and Xavier, for the helpful answers. This is exactly what I was looking for.
Best,
Nick
________________________________
From: Jesse Lucas via Modules-interest <mod...@li...>
Sent: Wednesday, August 18, 2021 10:50 PM
To: Environment Modules usage and discussion. <mod...@li...>
Cc: Jesse Lucas <je...@bl...>
Subject: Re: [Modules] Variable interpolation within set-alias and set-function
On Wed, Aug 18, 2021 at 8:26 PM Dusek, Nick via Modules-interest
<mod...@li...> wrote:
[snip]
> How do I instruct Modules to interpolate "$var" to its value of "hello" before exporting the function, rather than exporting it with "$var" verbatim?
Others may have better answers, but to get you moving:
Braces in Tcl act like single quotes in shell scripts, disabling
variable interpolation. You can use
quotes with the caveat that you then need to escape any dollar signs
you use in your shell script.
#%Module 1.0
set var "hello"
set-function greeting "
foo=1
bar=2
echo $var \$foo \$bar
"
_______________________________________________
Modules-interest mailing list
Mod...@li...
https://lists.sourceforge.net/lists/listinfo/modules-interest
|