Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH?] Nofork and removing newlines



On Thu, Mar 7, 2024 at 12:26 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 3/7/24, Lawrence Velázquez <larryv@xxxxxxx> wrote:
> >
> >       % print ${:-{}x}
> >       {}x
> >       % print "${:-{}x}"
> >       {x}
>
> This is not really an effect of quoting per se, really it's just luck
> that the unquoted form works. [...] Your example only
> happens to pass the parsing stage because the braces are balanced
> which they have no inherent reason to do in what is supposedly a
> string literal.

It passes the balanced braces because this:

% print ${:-{a,b,c}x}
ax bx cx

And because this:

% print {}
{}

I'm leaving this in the same discussion thread because I just noticed
that ${|...} and ${ cmd } do not really respect the
IGNORE_CLOSE_BRACES option.  Setting that option changes handling of
unbalanced braces (and I'm not yet sure if it does so in a sensible
way) but does not force use of the semicolon e.g. in ${ cmd; } which
theoretically it should.  Is this worth trying to work in?




Messages sorted by: Reverse Date, Date, Thread, Author