zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: question about glob qualifier format (#qx)
Date: Fri, 20 Sep 2013 12:38:30 +0100	[thread overview]
Message-ID: <20130920123830.30111071@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20130920111110.GA4501@localhost.localdomain>

On Fri, 20 Sep 2013 19:11:10 +0800
Han Pingtian <hanpt@linux.vnet.ibm.com> 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


  reply	other threads:[~2013-09-20 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 11:11 Han Pingtian
2013-09-20 11:38 ` Peter Stephenson [this message]
2013-09-20 23:39   ` Han Pingtian
2013-09-21  8:30     ` Bart Schaefer

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=20130920123830.30111071@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).