zsh-users
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: ZyX <kp-pav@yandex.ru>
Cc: Mikael Magnusson <mikachu@gmail.com>,
	"vogt@linux.vnet.ibm.com" <vogt@linux.vnet.ibm.com>,
	Zsh Users <zsh-users@zsh.org>
Subject: Re: Recursive globbing shorthand (a la **.c)
Date: Wed, 28 Oct 2015 21:15:32 +0000	[thread overview]
Message-ID: <20151028211532.GA16113@chaz.gmail.com> (raw)
In-Reply-To: <240121446059044__35603.2418822453$1446059490$gmane$org@web30h.yandex.ru>

2015-10-28 22:04:04 +0300, ZyX:
[...]
> This depends on how you treat patterns. In mercurial `**` is
> treated as `.*` and `*` is treated as `[^/]*`, so pattern
> `a**b` matches file `a/c/b` (note. With such interpretation
> transforming foo** into foo*/**, **bar into **/*bar and
> foo**bar into foo*/**/*bar makes perfect sense. Though
> mercurial is using regexps on a list of files, not the real
> globbing, this behaviour is official and not an accident:
> there are patterns like `**.c` in examples. As OP said this is
> convenient in many cases.
[...]

That's also the behaviour of globbing in the  fish shell.

That means that for instance you cannot match dot files (or any
pattern matching on the beggining of the file in fish.

For zsh's **/.*, in fish you'd need both .* and **/.*

I prefer zsh behaviour.

ksh93, bash and tcsh support ** alone, but not **.c

See also
http://unix.stackexchange.com/questions/62660/the-result-of-ls-ls-and-ls/62665#62665

BTW, a related question:

In zsh (also in yash and tcsh now), *** is the version of **
that traverses symlinks.

Also,

*.d/foo

traverses symlinks,

(*.d)#/foo

doesn't

** is short for (*/)#

Is there a way to do */foo without traversing symlinks (other
than l=(*(/N)); l=($^l/foo(N)); (($#l)) && cmd $l)?

(*/)(#c1)foo doesn't work

Or (^.svn/)#foo.c that traverses symlinks?

-- 
Stephane



  parent reply	other threads:[~2015-10-28 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  6:57 Dominik Vogt
2015-10-28 13:27 ` Mikael Magnusson
2015-10-28 19:04   ` ZyX
     [not found]   ` <240121446059044__35603.2418822453$1446059490$gmane$org@web30h.yandex.ru>
2015-10-28 21:15     ` Stephane Chazelas [this message]
2015-10-29 10:15   ` Dominik Vogt
2015-10-29 10:53 ` Peter Stephenson

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=20151028211532.GA16113@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=kp-pav@yandex.ru \
    --cc=mikachu@gmail.com \
    --cc=vogt@linux.vnet.ibm.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).