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.