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

Re: Nofork ${{var}...} edge cases



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