zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Use glob patterns while reading a file
Date: Mon, 12 Nov 2018 10:14:08 +0000	[thread overview]
Message-ID: <1542017648.6073.1.camel@samsung.com> (raw)
In-Reply-To: <CAH+w=7Y6t1u-q-5ioxPCKw3Cu+VCoErfypSyU+NJ_Ov9fWFq+A@mail.gmail.com>

Certainly $(<...) was always intended to make it easier to get hold of a
single file, so has never done globbing (which would logically imply
multios, if the option is on), although I'm not aware of any fundamental
reason why it would break anything if it did (the implementation is
actually rather different from normal redirection as the file is simply
read in bodily).

However, the documentation does say it's equivalent to using the cat
command, which isn't true if var(foo) has globbing characters in it ---
I presume when the manual entry was written nobody considered it might.

The sentence after is also a bit unclear --- I'm not sure which the two
cases referred to are, but I presume they're unquoted $(...) with a
normal command and unquoted $(<...).  As the case of double quotes is
mentioned (although in the negative) in between, this doesn't seem
ideal.

It doesn't explicitly say what happens if the expressions is quoted,
though it does imply the final newlines are removed in any case so I
suppose there's enough to go on.

Any number of trailing newlines are removed, not just one.  I suppose
"any trailing newlines" (plural) does cover that.

pws

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index c791097..fbcf5d1 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1683,10 +1683,17 @@ any trailing newlines deleted.
 If the substitution is not enclosed in double quotes, the
 output is broken into words using the tt(IFS) parameter.
 vindex(IFS, use of)
+
 The substitution `tt($LPAR()cat) var(foo)tt(RPAR())' may be replaced
-by the equivalent but faster `tt($LPAR()<)var(foo)tt(RPAR())'.
-In either case, if the option tt(GLOB_SUBST) is set,
-the output is eligible for filename generation.
+by the faster `tt($LPAR()<)var(foo)tt(RPAR())'.  In this case var(foo)
+undergoes single word shell expansions (em(parameter expansion),
+em(command substitution) and em(arithmetic expansion)), but not
+filename generation.
+
+If the option tt(GLOB_SUBST) is set, the result of any unquoted command
+substitution, including the special form just mentioned, is eligible for
+filename generation.
+
 texinode(Arithmetic Expansion)(Brace Expansion)(Command Substitution)(Expansion)
 sect(Arithmetic Expansion)
 cindex(arithmetic expansion)


           reply	other threads:[~2018-11-12 10:24 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAH+w=7Y6t1u-q-5ioxPCKw3Cu+VCoErfypSyU+NJ_Ov9fWFq+A@mail.gmail.com>]

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=1542017648.6073.1.camel@samsung.com \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@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).