Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Recursive globbing shorthand (a la **.c)
- X-seq: zsh-users 20848
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: ZyX <kp-pav@xxxxxxxxx>
- Subject: Re: Recursive globbing shorthand (a la **.c)
- Date: Wed, 28 Oct 2015 21:15:32 +0000
- Cc: Mikael Magnusson <mikachu@xxxxxxxxx>, "vogt@xxxxxxxxxxxxxxxxxx" <vogt@xxxxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=xjfp8O4kZkk6+BGnUad1+2zdTFtyca3oysxYpHh4mlg=; b=uryFBk02RVbvwGGsi7/U1Hlh5Rsk0Ma8wzn4N+9s+32nxiyOnNlQV7N8RbYrEq6isZ BdKVGU+gXqydgq9DmUhi0B6dLzM9u5oBG0ywdl4kehGpf8mHpb592hHKk+r0RGGe6IwV B+Pc1UXNLLW7sB80FIOXIvoTRjGMUVvpRotXmJEJYdGMVmeQR3x4er1kY/utnuPPtSA2 m6kF2pJgBh7juO9giYD13QinPj8/qp5mH1IneW+WeaDRMe7dEvIMCUMsDqOwNNeVRfCO bxd89TYSgsk1qzAaBX663JxNV6XupeII/g5o/jph+ZbwzNXu81jfpzTLynYXx82AqyQH sZ2A==
- In-reply-to: <240121446059044__35603.2418822453$1446059490$gmane$org@web30h.yandex.ru>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: ZyX <kp-pav@xxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>, "vogt@xxxxxxxxxxxxxxxxxx" <vogt@xxxxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20151028065702.GA8236@linux.vnet.ibm.com> <CAHYJk3TjmMEYZ-j5VT=D4WDPtZZkFVzKNXzYw9vxZReC0o-FZg@mail.gmail.com> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author