From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: Counting characters in command output?
Date: Thu, 15 Feb 2024 23:53:26 -0500 [thread overview]
Message-ID: <8fc8b27a-9f1b-4d7f-8865-cbf41cc7374e@app.fastmail.com> (raw)
In-Reply-To: <CAH+w=7brXaXfsCi5wXnYNZgZmKVqis6u3T3bPtQuqCHcbpnqKA@mail.gmail.com>
On Thu, Feb 15, 2024, at 8:53 PM, Bart Schaefer wrote:
> If you want command substitution without word splitting, then in
> whatever the next version ends up being called you have
> ${ command }
> to do that for you
Hm, I wasn't aware of this detail. I see it's mentioned in zshexpn(1)
but don't see anything in the FAQ. Worth mentioning?
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 7d46e9192..d8c1fe2dd 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -1081,6 +1081,11 @@ sect(Comparisons of forking and non-forking command substitution)
bash and ksh, so in emulation modes, newlines are stripped from command
output (not from mytt(REPLY) assignments).
+ Unless enclosed in double quotes, the expansion of mytt($(command)) is
+ split on mytt(IFS). In contrast, and contrary to bash and ksh, unquoted
+ mytt(${ command }) and its variants are not split unless the
+ mytt(SH_WORD_SPLIT) option is set.
+
When mytt(command) is myem(not) a builtin, mytt(${ command }) does fork, and
typically forks the same number of times as mytt($(command)), because in
the latter case zsh usually optimizes the final fork into an exec.
--
vq
next prev parent reply other threads:[~2024-02-16 4:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 20:38 Mark J. Reed
2024-02-13 20:41 ` Roman Perepelitsa
2024-02-14 0:45 ` Mark J. Reed
2024-02-14 6:49 ` Roman Perepelitsa
2024-02-14 13:56 ` Mark J. Reed
2024-02-14 15:36 ` Ray Andrews
2024-02-14 15:58 ` Mark J. Reed
2024-02-14 16:30 ` Ray Andrews
2024-02-15 14:34 ` Lawrence Velázquez
2024-02-15 9:50 ` Roman Perepelitsa
2024-02-15 14:30 ` Lawrence Velázquez
2024-02-15 15:29 ` Ray Andrews
2024-02-15 16:16 ` Roman Perepelitsa
2024-02-15 16:55 ` Ray Andrews
2024-02-15 14:53 ` Ray Andrews
2024-02-16 1:53 ` Bart Schaefer
2024-02-16 4:53 ` Lawrence Velázquez [this message]
2024-02-16 18:03 ` Bart Schaefer
2024-02-16 18:38 ` Mark J. Reed
2024-02-16 19:36 ` Bart Schaefer
2024-02-16 19:37 ` Lawrence Velázquez
2024-02-16 21:06 ` Mikael Magnusson
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=8fc8b27a-9f1b-4d7f-8865-cbf41cc7374e@app.fastmail.com \
--to=larryv@zsh.org \
--cc=schaefer@brasslantern.com \
--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).