MULTIDEFINE(1) BSD General Commands Manual MULTIDEFINE(1)
NAME
multidefine — split a value and defines several variables at once, then execute another program
SYNOPSIS
In an execlineb(1) script:
multidefine [−0] [−r] [−C | −c] [−N | −n] [−d delim] value { variables... } prog...
DESCRIPTION
multidefine reads a block (
cf. execline-block(7) ) containing a list of variables. That block must not be empty.
multidefine splits (
cf. execline-transform(7) ) value, and performs other operations depending on the given options.
multidefine performs parallel substitution (
cf. execline-substitute(7) ) 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 exec(3)s 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 (
cf. execline-transform(7) ) the substitution mechanism. Note that the value is always split.
SEE ALSO
define(1), elgetpositionals(1), elglob(1), execlineb(1), importas(1), multisubstitute(1), exec(3), execline-block(7), execline-substitute(7), execline-transform(7)
This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/multidefine.html
AUTHORS
Laurent Bercot
Alexis <
[email protected] > (man page port)
BSD February 14, 2021 BSD