execline
Software
skarnet.org
The multidefine program
multidefine splits a value and defines several variables at once,
then executes another program.
Interface
In an execlineb script:
multidefine [ -0 ] [ -r ] [ -C | -c ] [ -N | -n ] [ -d delim ] value { variables... } prog...
- multidefine reads a block
containing a list of variables. That block must not be empty.
- multidefine splits
value, and performs other operations depending on the given
options.
- multidefine performs
parallel substitution on
prog..., using all of the variables in the block as keys.
The first word in the split value is assigned to the first
variable, the second word is assigned to the second variable,
and so on. Every variable is substituted with exactly one word.
- If a variable is the empty word, then the word in the split
value corresponding to its position is not substituted. So you can
use empty words to pad the list of variables and only perform substition
on the relevant fields.
- multidefine then execs into the modified prog....
Options
- -0 : if there are more variables in the block than
there are words in the split value, the excess variables
will be replaced with zero word. Without this option, the excess variables are
replaced with the empty word.
- -r : behave similarly to the "read" shell command.
If there are more words in the split value than there are
variables in the block, the last variable will be replaced with all
the remaining words (and will be split). Without this option, the last variable
is replaced with a single word, and the excess words are lost.
- Other options are used to control the
substitution mechanism. Note that the value is always split.