This due to the curly braces used around the function content. In Tcl curly
braces mean the content is set verbatim, no variable resolution occurs.
Use double quotes instead curly braces and it should be ok:
$ cat test
#%Module
set ppath /path/to/apps
set package app
set version x.y.z
set-function appalias "$ppath/$package/$version/scripts/thing --option"
$ module load ./test
$ declare -f appalias
appalias ()
{
/path/to/apps/app/x.y.z/scripts/thing --option
}
Regards,
Xavier
Le mer. 10 août 2022 à 18:40, Gretton, Liam <lia...@le...>
a écrit :
> Thanks for the explanation.
>
>
>
> I'm almost there with this, just having problems passing Tcl variables
> into the set-function definition.
>
>
>
> Our module files define the application path at the start like so:
>
>
>
> set ppath /path/to/apps
>
> set package app
>
> set version x.y.z
>
>
>
> In set-alias I can just refer to those as so:
>
>
>
> set-alias appalias "$ppath/$package/$version/scripts/thing --option"
>
>
>
> But in set-function everything within the braces is passed through to the
> shell literally and the variable values aren't passed:
>
>
>
> set-function appalias { $ppath/$package/$version/scripts/thing --option }
>
>
>
> declare -f appalias
>
> appalias ()
>
> {
>
> $ppath/$package/$version/scripts/thing --option
>
> }
>
>
>
> …instead of
>
>
>
> declare -f appalias
>
> appalias ()
>
> {
>
> /path/to/apps/app/x.y.z/scripts/thing --option
>
> }
>
>
>
> How can I get those variables declared within the module to be
> dereferenced in the function definition? This could be just my Tcl-foo
> being inadequate.
>
>
>
> Thanks,
>
> Liam
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
|