Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I quite like mercurial .hgignore-style pattern globbing.

Globs are rooted at the current directory; a glob such as *.c will only match files in the current directory ending with .c.

The supported glob syntax extensions are ** to match any string across path separators and {a,b} to mean "a or b".

Is there a Linux shell that supports this?

share|improve this question
The section you quote is actually not about the .hgignore ignore patterns — they're not rooted for example. The section is about the general pattern supported by all commands. You use them like hg add "set:**.c", which works even when your shell doesn't (e.g., on Windows). – Martin Geisler Jun 20 '13 at 6:59
up vote 2 down vote accepted

All shells will support the standard glob *.c. KSH, Bash, and ZSH support brace expansion ({a,b}), but note that this not a file glob, so it will always expand. ZSH's extended globbing and Bash's globstar (bash v4 or higher), support ** for recursive globbing.

share|improve this answer
brace expansion originates in csh, ** comes from zsh (1991) and is now supported by ksh93 and tcsh. Also with bash and fish but with the caveat that they follow symlinks when recursing. zsh and tcsh have *** to follow symlinks. – Stéphane Chazelas Jun 19 '13 at 21:25
@StephaneChazelas I tested ** in ksh93 without the expected results. Does it require enabling a feature like globstar in bash? – jordanm Jun 19 '13 at 21:29
yes, they all do except zsh. set -G in ksh93. bash got it from ksh93 as most things. See also that answer – Stéphane Chazelas Jun 19 '13 at 21:47
@jordanm Thank you for suggesting Bash globstar. It is especially the recursive ** that I am after. – Serge Stroobandt Jun 19 '13 at 21:58
In Bash you can use shopt -s nullglob as well to avoid getting literally *.c if there is no file match. – l0b0 Jun 20 '13 at 8:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.