$ printf '%s\n' "${| REPLY=( zero one two ); }"
zero
$ printf '%s\n' "${@ REPLY=( zero one two ); }"
zero
one
two
$ printf '%s\n' "${* REPLY=( zero one two ); }"
zero one two

Like the ${| command; } form, REPLY within the funsub starts life as
an initially-unset local variable, not an initially empty indexed
array variable. That way, REPLY can become either an indexed or
associative array within the funsub.

If REPLY is left unset, "${@ command; }" would expand to nothing,
rather than the empty string, when double-quoted.

When REPLY remains a scalar but is set, ${@ command; } and ${*
command; } would behave identically to ${| command; }.

Would allow, for instance:
$ foo=3
$ for x in "${@ eval "REPLY=( {0..${foo}} )"; }"; do
>   printf '%s\n' "${x}"
> done
0
1
2
3

Admittedly, ${* command; } wouldn't give you anything you can't get
with ${| command; }.
printf '%s\n' \
    "${|
      local -a array=( zero one two )
      REPLY="${array[*]}"
    }"
zero one two

So the only real purpose in adding that would be congruence with
${@}/${*} and ${array[@]}/${array[*]}.

Zack

Reply via email to