From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27108 invoked by alias); 20 Sep 2013 11:38:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17984 Received: (qmail 27852 invoked from network); 20 Sep 2013 11:38:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f5-b7ef66d00000795a-7b-523c33b8ec9b Date: Fri, 20 Sep 2013 12:38:30 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: question about glob qualifier format (#qx) Message-id: <20130920123830.30111071@pwslap01u.europe.root.pri> In-reply-to: <20130920111110.GA4501@localhost.localdomain> References: <20130920111110.GA4501@localhost.localdomain> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Nd0dxjZBBlPWM1vsOLmS0YHRY9XB D0wBjFFcNimpOZllqUX6dglcGXv/bGIqOMxV8f7CC8YGxp/sXYycHBICJhIPv+xjhrDFJC7c W8/WxcjFISSwlFHi6N+3TFAOk8Tpz1fAOlgEVCWmvfzFBmKzCRhKTN00mxHEFhEQlVi+YjNY jbCAucTtCcfApvIK2Etc738HVs8pYCWx/81TVhBbSMBSonnJNLAafgF9iat/PzFBXGEvMfPK GUaIXkGJH5PvsYDYzAJaEpu3NbFC2PISm9e8ZZ7AKDALSdksJGWzkJQtYGRexSiaWppcUJyU nmukV5yYW1yal66XnJ+7iREShF93MC49ZnWIUYCDUYmH94SwdZAQa2JZcWXuIUYJDmYlEd7e /0Ah3pTEyqrUovz4otKc1OJDjEwcnFINjBf4NhlOFxDWl42cXVD5IGJKXM6699F3H5dUOAbw MxXPqr8uw/9rf3d6/4W2BIvP7Vxrlx6Lz+GW/OwfL3TBopb962MJnqNr7f58cCpwKZ79VCru 84/s/ue/tkU8mnrU5ER8xvcljq0b9bL3unElHZPu8jvt+OBInFWAZJOEwqNbWve47GXclViK MxINtZiLihMB/oWNNiACAAA= On Fri, 20 Sep 2013 19:11:10 +0800 Han Pingtian wrote: > I'm confused about the usage of glob qualifier format "(#qx)". The man > page says: > > ...... Also, as the syntax is unambiguous, > the expression will be treated as glob qualifiers just as long any > parentheses contained within it are balanced; appearance of `|', `(' or > `~' does not negate the effect. > > But looks like if I put them in parentheses, it will not take effect any more: > > > $ ls > 1.c 2.h a b slink > $ echo *((#q/)) > 1.c 2.h a b slink > > So I'd like to know how to comprehend the manpage here? Thanks in > advance! Because of the ambiguity between glob qualifiers without the #q and parenthesised groups, the shell guesses which is which. An expression containing "|" makes it guess that it's a parenthesised group rather than a set of glob qualifiers. However, if the *first* open parenthesis (there's no reason to double them) is followed by #q (and EXTENDED_GLOB is set), it knows for sure that this is a glob qualifier, so it doesn't need to do any guessing. This is there as an additional help; you don't need to change your normal use of glob qualifiers just because you've signalled them explicitly with #q. (#q/) works fine. pws