Pass ARRAY arguments to set-alias in modulefile

188 Views Asked by At

all. I need to use a function that must be declared within an environment module, so I'm trying to define it with set-alias. Here's the tricky thing, the parameter it takes is an array. So far, as a test I've tried this:

set-alias test  {
    declare -a argArray=(\"${@}\");
    echo \${\#argArray}
}

which returns zero : (

0

the (potentially) awful amount of back-slashes is needed, as module doesn't get along well with single quotes (so they say in manpage). can somebody explain me what's going on?

thanks

1

There are 1 best solutions below

0
Bhargav Katkam On
  • Don't use set-alias for writing functions
  • Environment modules are tcl based

You can use proc for writing functions:

proc test {arg1} {
    return [llength $arg1]
}