Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
nesting issue
- X-seq: zsh-users 29886
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: nesting issue
- Date: Sat, 4 May 2024 12:36:01 -0700
- Archived-at: <https://zsh.org/users/29886>
- List-id: <zsh-users.zsh.org>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author