grep annoyance!
Alan Dayley
plug-devel@lists.PLUG.phoenix.az.us
Fri Apr 15 11:11:02 2005
GNU grep has annoyed me for a very long time for this one "fault" and it
happened again just now. I had to whine about it.
- Suppose I have a directory structure like so:
project1---ui------frame.c
| |-enter.c
| \-ui.h
|-logic---main.c
| |-transaction.c
| \-main.h
|-README
\-COPYING
- Suppose I want to do a grep seach of all the .c files for "string"
I go to the project1 directory and issue the command and get this result:
$grep -r string *.c
grep: *.c: No such file or directory
$
The Annoyance: The '-r' option is supposed to recurse the subdirectories
in the tree. BUT, it fails and stops the search because my current
directory, project1, does not have any files that match '*.c' It does not
recurse!
I have gotten around this in the past by doing 'touch bogus.c' in the
current directory so that it will not fail and will start recursing. But
that is a lousy workaround.
Is there a option to grep that I just don't understand yet that will make
grep recurse even if the current directory doesn't have a match on the
file expression?
Alan