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

Re: Brace expansion vs. TAB



On Sat, Dec 07, 2019 at 11:05:01AM +0100, Mikael Magnusson wrote:
> On 12/6/19, Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> > (Using zsh 5.3.1 on Debian.)
> >
> > In a directory with c++ sources:
> >
> >   $ ls *
> >   foo.cpp  foo.h
> >
> > Now,
> >
> >   $ grep ... *.{hpp,cpp}<TAB>
> >
> > Q2:
> >
> > What I really want to have is a simple way to get all c and c++
> > filenames in a singel pattern, like
>
> *.(hpp|cpp)

Ah, thanks.  This works:

  alias -g CH="*.(c|h|cpp|hpp|cxx|hxx)"
  alias -g CHR="**/*.(c|h|cpp|hpp|cxx|hxx)"

  grep foo CHR
  grep bar CH

> or for that matter, *.[hc]pp

Nope.  Doesn't match header files wit .h suffix.

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt



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