zsh-users
 help / color / mirror / code / Atom feed
* nesting issue
@ 2024-05-04 19:36 Ray Andrews
  2024-05-05  3:20 ` Bart Schaefer
  0 siblings, 1 reply; 18+ messages in thread
From: Ray Andrews @ 2024-05-04 19:36 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

Getting more comfortable with nesting things:

#1:
local in=($1,*(N))
#2:
local sorted=$(print -l "${(n)in[@]}")
#3:
sorted=( "${(f)sorted}" )

     ... works fine, now I do an  exact verbatim nesting of line two 
into line three:

local sorted=( "${(f)$(print -l "${(n)in[@]}") }" )

     "bad substitution".  Ok, that could be because we can't nest quotes so:

local sorted=( "${(f)$(print -l "${(n)in[@]}") }" )
local sorted=( "${(f)$(print -l \"${(n)in[@]}\") }" )
local sorted=( "${(f)$(print -l ${(n)in[@]}) }" )
local sorted=( ${(f)$(print -l ${(n)in[@]}) } )

     .... none of those work.  Is this something were a literal 
substitution of one block of characters can't work?  It hardly matters 
in practice, I prefer the three steps above, it's easier to digest, but 
purely as a theoretical question, can I nest line two and three, or even 
all three lines?  I'd like to understand why the parser doesn't like my 
efforts.  I can see that the 'no nested quotes' rule could make some 
literal substitutions logically impossible. But maybe there is a way.  
If so, seeing how will be instructive.



[-- Attachment #2: Type: text/html, Size: 1600 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-05-06 13:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-04 19:36 nesting issue Ray Andrews
2024-05-05  3:20 ` Bart Schaefer
2024-05-05  5:39   ` Lawrence Velázquez
2024-05-05  5:40   ` Roman Perepelitsa
2024-05-05 13:52     ` Ray Andrews
2024-05-05 20:14       ` Lawrence Velázquez
2024-05-05 22:18         ` Ray Andrews
2024-05-05 23:26           ` Lawrence Velázquez
2024-05-06  1:51             ` Ray Andrews
2024-05-06  3:22               ` Bart Schaefer
2024-05-06 13:01                 ` Ray Andrews
2024-05-06  3:43               ` Lawrence Velázquez
2024-05-06 13:09                 ` Ray Andrews
2024-05-05 13:13   ` Ray Andrews
2024-05-05 19:44     ` Lawrence Velázquez
2024-05-05 20:14       ` Ray Andrews
2024-05-05 20:45         ` Lawrence Velázquez
2024-05-05 22:22           ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).