0

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

coatless
  • 20,011
  • 13
  • 69
  • 84

1 Answers1

1
  • 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]
}