Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Nofork ${{var}...} edge cases
- X-seq: zsh-workers 52836
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Nofork ${{var}...} edge cases
- Date: Thu, 28 Mar 2024 01:29:09 +0100
- Archived-at: <https://zsh.org/workers/52836>
- In-reply-to: <CAH+w=7YHZspc2JVBxkkYO69Cr9x__s-m4UQqRUfOetZYssUqnw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7YHZspc2JVBxkkYO69Cr9x__s-m4UQqRUfOetZYssUqnw@mail.gmail.com>
On Wed, Mar 27, 2024 at 7:58 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Just seeking opinions:
>
> Should ${{} true} (empty variable name) result in "bad substitution"?
> Otherwise it's all side-effects, because nothing will be substituted.
> The prior ${|| true} form was a parse error.
>
> Should ${{var}} be a "bad substitution", or print a warning about an
> empty command? Otherwise it just substitutes $var.
Is a space no longer required after } (formerly ||) to trigger the
command substitution? I personally would like to get an error in this
case because missing a $ in nested substitutions is a fairly common
typo. Eg I meant ${${var}}. And if no space is required, does that
mean if you typo ${${foo}:-blabla} into ${{foo}:-blabla}, :-blabla is
suddenly executed as a command? If the space is actually still
required then I don't have any real complaints. I think it was clearer
at a glance that ${|foo| bing} was doing something different as
opposed to ${{foo} bing} but i suppose i don't feel that strongly
about it.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author