Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: no-fork expansion with array var
- X-seq: zsh-workers 52182
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: no-fork expansion with array var
- Date: Sat, 23 Sep 2023 14:46:50 +0200
- Archived-at: <https://zsh.org/workers/52182>
- In-reply-to: <CAH+w=7a=u44wKkGAj5o_7g=bRN5j_Y5ubK1W=8i-TwkdMnsEFg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHYJk3Rpjg6SUCO7NbpMjwXBpzvR_ZfEpzH--wu7pPrY0zpKDQ@mail.gmail.com> <CAH+w=7Y64X4FuLhwUuTtUygXd0o0oxRO1YCFoV5hHvGJ+f4-sA@mail.gmail.com> <CAH+w=7a=u44wKkGAj5o_7g=bRN5j_Y5ubK1W=8i-TwkdMnsEFg@mail.gmail.com>
On 9/23/23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Fri, Sep 22, 2023 at 4:16 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> wrote:
>>
>> On Fri, Sep 22, 2023, 4:00 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>>>
>>> The documentation says:
>>> If param names an array, array expansion rules apply.
>>>
>>> But what it means is if you do an array assignment to var inside the
>>> code block, array expansion rules apply
>
> How about this?
>
> diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
> index 86a5f70c8..837a85db6 100644
> --- a/Doc/Zsh/expn.yo
> +++ b/Doc/Zsh/expn.yo
> @@ -1915,8 +1915,9 @@ Substitutions of the form
> `tt(${|)var(param)tt(|)...tt(})' are similar,
> except that the substitution is replaced by the value of the parameter
> named by var(param). No implicit save or restore applies to var(param)
> except as noted for tt(REPLY), and var(param) should em(not) be declared
> -within the command. If var(param) names an array, array expansion rules
> -apply.
> +within the command. If, after evaluating the expression, var(param)
> +names an array, array expansion rules apply. However, tt(REPLY) is
> +always expanded in scalar context, even if assigned an array.
>
> A command enclosed in braces preceded by a dollar sign, and set off from
> the braces by whitespace, like `tt(${ )...tt( })', is replaced by its
That works for me.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author