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

Re: illegal space





On 2026-11-28 17:35, Mark J. Reed wrote:
I find it easiest to think of the ${(...)$( as really all one long opening construct.  After all, the ${...} is only there so you can put flags on the $(...), which on its own has no place to put them. 
Hmmm.  So "$((f) ..." might have been possible, at least in theory?  Or maybe nightmarish parsing since '$(('  opens a math operation.  Anyway I like your thinking, you can't crack a gramm atical construct in half, canya?  Anyway keystrokes aren't ever a problem, clarity is the virtue.  
=========================
So the extended (flagful) version of $(...) is ${(...)$(...)} and you can't have any spaces anywhere until after the second (.

On Sat, Nov 28, 2026 at 9:58 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:


On 2026-11-28 07:25, Philippe Altherr wrote:
> It's the `${` that objects to the space. It must be immediately
> followed by a parameter name, another substitution, a command
> substitution, or a parenthesized list of flags which is itself
> immediately followed by a parameter name, another substitution, or a
> command substitution. None of these allow a space at their beginning.
Ah!  I know that you can't do: '${ (f)' because it would be ambiguous to
parse.  But the rule holds true even without the flag. Ok, that's
consistent and even if the space in my example might in theory do no
mischief, there's no reason the break the rule. Thanks, that's clear.
I'm glad it's not the '$(' that's at issue.




--
Mark J. Reed <markjreed@xxxxxxxxx>



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