To properly expand multiple variables in execline, in the following
case (any time you need to expand a variable after another expansion
command):

    importas -i x VARA
    cmdA argA $x
    importas -i y VARB
    cmdB argB $x $y

To prevent literal "$y"s or "${y}"s in the value of VARA ($x) from
expanding, you must replace the second expansion command with a
multisubstitute, and give the variable that was declared before
multisubsitete another name using define; e.g.:

    importas -i x VARA
    cmdA argA $x
    multisubstitute {
        define newx $x
        importas -i y VARB
    }
    cmdB argB $newx $y

But, unfortunately, it is not possible to use this
"multisubstitute { define" techinque with variables that have been
defined using e.g. `elglob', `define -s', `importas' (without -i/-D),
etc.
Those variables can expand to zero, one, or more than one values. And
there is currently no easy way to define a variable like this directly
from a list of values.

It would be nice if there was a command like:

    defines varname { [values]... } prog...

(maybe with a better name)

That expands $varname/${varname} in prog to the values listed in the
block (that may be 0 values, or many values); and can also be used from
multisubstitute.

With this, it will finally be possible to do something like:

    elglob cfiles *.c
    cmdA argA $cfiles
    multisubstitute {
        defines newcfiles { $cfiles }
        backtick foo { bar }
    }
    cmdB argB $foo $cfiles

o/
 emanuele6

Reply via email to