Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Recursive globbing shorthand (a la **.c)



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