From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id f9952b41 for ; Mon, 12 Nov 2018 10:24:40 +0000 (UTC) Received: (qmail 28669 invoked by alias); 12 Nov 2018 10:24:25 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43820 Received: (qmail 25431 invoked by uid 1010); 12 Nov 2018 10:24:25 -0000 X-Qmail-Scanner-Diagnostics: from mailout2.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(210.118.77.12):SA:0(-7.6/5.0):. Processed in 3.318136 secs); 12 Nov 2018 10:24:25 -0000 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181112101410euoutp027b97d54e5598fd753c395d02b3b8905d~mWOIlXVns2028820288euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542017650; bh=p7wxbg59vXdIRZ0cl6A80OfZ6ZXyIfgU/jfpDFt0HwU=; h=Subject:From:To:Date:In-Reply-To:References:From; b=TGTQ1548r/f/0hDw2SB97q4uFV/gh5VJCh7TpI4ataP99QVwuj3BMwyBE9GaZ7vff GuQb+OFtfEGOAfnvxkczHTjosJx6IpXgH6ZRNE5f9fyLdD2AMvPqoPR3MdxSDQ/mMO g+W/eTcHHUTnEQoJIkb4iKa30TlkvpRY7cSUf8oA= X-AuditID: cbfec7f4-835ff700000010c6-cb-5be9527251bb Message-ID: <1542017648.6073.1.camel@samsung.com> Subject: Re: Use glob patterns while reading a file From: Peter Stephenson To: "zsh-workers@zsh.org" Date: Mon, 12 Nov 2018 10:14:08 +0000 In-Reply-To: X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsWy7djPc7pFQS+jDZq2sVgcbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujI7b99gKpgtVTP5g0sA4jb+LkZNDQsBE4tviFcxdjFwcQgIr GCWWnN/CCuH0MUlMeXGXDaRKSKCXSeJAk1wXIwdYx4RT4hA1yxklbr+/yw7hANU8PdLBCNFw hlHi+m4HiMQFRon57w6BJXgFDCWm7njGAmILCxhLzGz5xgxis4HEN80GqxER0Je4+OcWmM0i oCoxb+cWMJtTIFCid+8ndoi7NSQ23DzGBDFTUOLkzCdgM5kF5CWat84G+0dC4D6bRP+B41AN LhIn1u1hhLCFJV4d3wIVl5E4PbmHBaKhnVFizaTX7BBOD6PEpqN3oDqsJfpuX2QEBQCzgKbE +l36EGFHidk3u1kh4cInceOtIMQRfBKTtk1nhgjzSnS0CUFUq0nsaNrKCBGWkXi6RmECo9Is JB/MQvLBLIRVCxiZVzGKp5YW56anFhvlpZbrFSfmFpfmpesl5+duYgSmgdP/jn/ZwbjrT9Ih RgEORiUeXo3SF9FCrIllxZW5hxglOJiVRHj5eF5GC/GmJFZWpRblxxeV5qQWH2KU5mBREuet ZngQLSSQnliSmp2aWpBaBJNl4uCUamAMPep0e+sa9vx/O1IknaNXCT0/usFjRYjb/+m2LyY8 jJdqmWy47Z6O13a+p69qdr65plVrYlLZ1L3QfKpAzGzpMw95U0/Pm/7TcOEz4X2xJbkn1bsP 2zXxSJyQayp+d0Fd9jhXN+/WC/sfahY4W7IJzX9kJ3dKL2/9xQzZqmSRiLpVvZtdLhxUYinO SDTUYi4qTgQAiWfAHf8CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRmVeSWpSXmKPExsVy+t/xu7qFQS+jDVbOE7I42PyQyYHRY9XB D0wBjFF6NkX5pSWpChn5xSW2StGGFkZ6hpYWekYmlnqGxuaxVkamSvp2NimpOZllqUX6dgl6 GR2377EVTBeqmPzBpIFxGn8XIweHhICJxIRT4l2MXBxCAksZJSZe2M3axcgJFJeR+HTlIzuE LSzx51oXG4gtJNDNJDGpywzCPsMo8f6ACkTzBUaJaV0fGEESvAKGElN3PGMBsYUFjCVmtnxj BrHZQOKbZoPViAjoS1z8cwvMZhFQlZi3cwuYzSkQKNG79xM7xNBlzBJfP98HSzALaEq0bv8N dZGGxIabx5gglglKnJz5hAWiRl6ieets5gmMQrOQtMxCUjYLSdkCRuZVjCKppcW56bnFhnrF ibnFpXnpesn5uZsYgYG/7djPzTsYL20MPsQowMGoxMOrUfoiWog1say4MvcQowQHs5IILx/P y2gh3pTEyqrUovz4otKc1OJDjKZAH01klhJNzgdGZV5JvKGpobmFpaG5sbmxmYWSOO95g8oo IYH0xJLU7NTUgtQimD4mDk6pBkYGk/UCK+cz7/se4NzvJmadLD3ttPS+lo4zDh4NRS4eocnH f8TwTlbeNdW9o3q+dtK1g0sMsxOnvfLz1PXrNAswSHPbvck3/t5Mvrf2e2blLljF522yZt+0 jKQWp55jk+KfVwT6y0bZf5Dfb/LRTCrHquLvHJcJxZ8fy88JOJC+2ML5wHXzRCWW4oxEQy3m ouJEAF6tjxySAgAA X-CMS-MailID: 20181112101409eucas1p2e86af0d5493f39e881b81336d1a4cde7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181108225555epcas2p274de218aef35e46f189ebbfbd9d1892f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181108225555epcas2p274de218aef35e46f189ebbfbd9d1892f References: <1541756153.3720.1.camel@samsung.com> <1541812878.2985396.1571973512.684C1909@webmail.messagingengine.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)