Red Hat Bugzilla – Bug 132651
grep -r should warn if no filenames are given
Last modified: 2007-11-30 17:10:49 EST
Description of problem:
If grep -r is given no filename parameters, it will wait until entry
is provided on stdin, just as if no -r has been specified. This is
annoying as if the filename is omitted grep hangs, but it is difficult
to tell the difference between grep taking a while and grep waiting
for stdin. I have spent ten minutes waiting for grep to finish a large
directory before realising it had been doing nothing.
As -r makes no sense on stdin (you can't recursively search a
filehandle), how about -r only working if you give a filename?
Steps to Reproduce:
1. Type command 'grep -r foo' into a console
Actual Results: Silence
Expected Results: Receive some indication that -r makes no sense on stdin
Created attachment 103867 [details]
Patch to correct this
Makes grep -r with no filenames stop with an error message.