Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Nofork ${{var}...} edge cases
- X-seq: zsh-workers 53710
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Nofork ${{var}...} edge cases
- Date: Sat, 31 May 2025 09:21:38 +0200
- Archived-at: <https://zsh.org/workers/53710>
- In-reply-to: <CAH+w=7ZpN6KVEWJGVjA-Yh8zYeQ1kRTxeaY8pZBmquv-XPVtmA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7YHZspc2JVBxkkYO69Cr9x__s-m4UQqRUfOetZYssUqnw@mail.gmail.com> <42966-1711578160.323146@w_2U.aZv1.yyMw> <CAH+w=7Y7gD8vKsk-=UEaf4N0j9u+ruNKS8nUZGZNAb23cRGSEQ@mail.gmail.com> <CAH+w=7akD45JDWRdRwrEbO9_2SMYgZYm2ctprx+JVo4F=Pur-Q@mail.gmail.com> <CAH+w=7ZpN6KVEWJGVjA-Yh8zYeQ1kRTxeaY8pZBmquv-XPVtmA@mail.gmail.com>
On Thu, Mar 28, 2024 at 2:33 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 27, 2024 at 6:21 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > > Hrm, unfortunately that gets a bit dicey, because ${ ... } relies on
> > > having the magic local $REPLY as a place to stash the captured stdout
> >
> > Oh, no, it doesn't: I confused myself because some the tests in D10 do so.
>
> Please ignore that. Both the tests AND the implementation do this. Ugh.
This just came up on IRC, and I'm not sure what the currently expected
result is here, and I couldn't find any test coverage for this either:
% REPLY=before; echo $REPLY ${ echo 1} ${| REPLY=2} $REPLY
before 1 2 1
I find it very surprising that REPLY is overwritten by ${ echo 1}
here, and I couldn't find anything in the man page about it other than
a vague statement about ${ foo} saying "Like ${|...}, the command
executes in the current shell context with function local behaviors",
but I don't think this would imply that REPLY gets overwritten, right?
And it's also surprising since ${| foo} goes to such lengths to
explicitly not overwrite it.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author