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

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



On Wed, Mar 27, 2024 at 5:29 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> > 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?

A space was never required, it was just a convention I always followed
when writing examples:
% echo ${|x|x=foo}
foo

mksh doesn't require a space in ${|REPLY=foo} either.

> I personally would like to get an error in this
> case because missing a $ in nested substitutions is a fairly common
> typo.

Yes, I was just musing about that possibility myself.

> 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?

With the patch as submitted so far, yes.  But requiring a space there
should be easy, and a pretty reasonable requirement.




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