sh icon indicating copy to clipboard operation
sh copied to clipboard

zsh: support double quotes around nested parameter expressions

Open LangLangBart opened this issue 2 months ago • 2 comments

./shfmt --language-dialect zsh <<<'${(f)"$(foo)"}'

actual

<standard input>:1:6: invalid parameter name

expected

${(f)"$(foo)"}

related

  • #1209
  • #1208

zsh docs

Note that double quotes may appear around nested expressions, in which case only the part inside is treated as quoted; for example, ${(f)"$(foo)"} quotes the result of $(foo), but the flag ‘(f)’ (see below) is applied using the rules for unquoted expansions.

Source: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion#:~:text=Note%20that%20double%20quotes%20may%20appear%20around%20nested%20expressions

LangLangBart avatar Oct 23 '25 14:10 LangLangBart

I continue to be baffled by the amount of shenanigans that parameter expansions in Zsh allow...

mvdan avatar Oct 24 '25 19:10 mvdan

Yeah, it's everything including the kitchen sink, and your kitchen sink, and a whole plumbing supplies store to boot.

theclapp avatar Oct 24 '25 20:10 theclapp