From: Ray Andrews <rayandrews@eastlink.ca>
To: Zsh Users <zsh-users@zsh.org>
Subject: nesting issue
Date: Sat, 4 May 2024 12:36:01 -0700 [thread overview]
Message-ID: <b26aef45-320d-4bf5-80e9-7ce0000afa3d@eastlink.ca> (raw)
[-- 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 --]
next reply other threads:[~2024-05-04 19:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-04 19:36 Ray Andrews [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b26aef45-320d-4bf5-80e9-7ce0000afa3d@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).