Yes It's correct anyway If we want to grep recursively all the *.cc *.h *.i we have to redefine the grepprg corectly

If your shell is zsh, or another that supports similar extended globbing you can just use:

:grep foo **/*.c

to do pretty much the same thing.

I did something very similar to this a while ago, and I agree it's very useful to do this from the shell. However, because I use it in all kinds of ways, I prefer to just have the shell script vimgrep emulate grep exactly. So that I can do:

find /etc | xargs vimgrep userid (for example)

So my vimgrep shell script behaves just like grep does and takes all greps args. It also doesn't bother starting Vim if grep returns zero matches.