From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10726 invoked by alias); 20 Sep 2013 23:50:09 -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: 17985 Received: (qmail 20382 invoked from network); 20 Sep 2013 23:49:51 -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 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at linux.vnet.ibm.com does not designate permitted sender hosts) Date: Sat, 21 Sep 2013 07:39:30 +0800 From: Han Pingtian To: zsh-users@zsh.org Subject: Re: question about glob qualifier format (#qx) Message-ID: <20130920233930.GB4501@localhost.localdomain> References: <20130920111110.GA4501@localhost.localdomain> <20130920123830.30111071@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130920123830.30111071@pwslap01u.europe.root.pri> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13092023-5806-0000-0000-000022CDF426 On Fri, Sep 20, 2013 at 12:38:30PM +0100, Peter Stephenson wrote: > 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 But I'm still confusing on the manpage :) If I want to list all symbolic links and directories in current directory, this expression doesn't work: $ echo (*(#q@)|*(#q/)) we must write it as : $ echo *(#q@) *(#q/) I cannot see any difference between '(#qx)' format and 'bare glob qualifier' format on being disabled by '|', '('. Please advise. Thanks.