Andre Gompel <address@hidden> wrote:
> grep : -r (recursive) option does not work in the follwing context:
>
> grep -ri string *.c
That isn't supposed to do what you want. Try this instead:
find . -name '*.c' | xargs grep -i string
grep -r searches *all* files in the directories you give on the
command line. It doesn't let you search just the files whose names
match a shell pattern. You specified *.c. The shell expanded this to
all names matching this pattern before grep ever saw it.
> Error message: "No such file or directory".
Presumably, there were no such files in your working directory, so the
shell left "*.c" unmodified. So grep looked for a file or directory
called "*.c", but there was none.
paul