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

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

On Wed, Oct 28, 2015 at 7:57 AM, Dominik Vogt <vogt@xxxxxxxxxxxxxxxxxx> wrote:
> Most of the time, I use recursive globbing to find files of
> certain types, e.g.
>   $ ll **/*.c
> With the zsh here (4.3.17), recursive globbing works only
> with a plain ** anyway (i.e. in "**x" and "x**" the ** works just
> like a plain "*").  So, is it possible (or a useful future
> feature) to make "**" imply a trailing "/*" if not with a trailing
> pattern?  Then we could type
>   $ ll **.c
> as a shorthand, and the "traditional" uses would work without
> change (e.g. **/*.c or **/foo).
> (Note that on German keyboards, "/" and "*" are very awkward to
> type in a sequence because both need the left shift key held and
> the keys for the right hand are very far apart, so this is really
> a usability issue.)

If this is something you do often, you can do
alias -g '**.c=**/*.c'

I don't think it's useful to implement generally though, there's no
particular reason to assume the pattern following the **/ should start
with a *

Mikael Magnusson

Messages sorted by: Reverse Date, Date, Thread, Author