multisubstitute performs several substitutions at once in its argv, then executes another program.
In an execlineb script:
multisubstitute { [ = [ -n ] [ -s ] [ -C | -c ] [ -d delim ] variable value ] [ $ [ -i | -D default ] [ -n ] [ -s ] [ -C | -c ] [ -d delim ] variable envvar ] [ import [ -i | -D default ] [ -n ] [ -s ] [ -C | -c ] [ -d delim ] envvar ] [ * [ -v ] [ -w ] [ -s ] [ -m ] [ -e ] [ -0 ] variable pattern ] [ elgetpositionals [ -P sharp ] ] [ multidefine value { variable... } ] ... } prog...
multisubstitute can be used to avoid unwanted serial substitutions. Consider the following script:
#!/command/execlineb export A wrong = B ${A} $ A A echo ${B}
Running it will print wrong, because A is substituted after B. On the contrary, the following script:
#!/command/execlineb export A wrong multisubstitute { = B ${A} $ A A } echo ${B}
will print ${A}, because A and B are substituted at the same time. Serial substitution may be what you want - but when in doubt, always perform parallel substitution.
Substitution is a costly mechanism: the whole argv is read three times and rewritten twice. Serial substitution multiplies the cost by the number of substitutions, whereas parallel substitution pays the price only once.
Paul Jarc first originated the idea of the multisubstitute command and a possible syntax.