On 10/08/2010 03:39 AM, Piotr Karkuciński wrote:
Hi,

I find bug in grep.

I create directory "--help"
Next I use command: grep -R "any string" *
and grep print help. Grep use directory name --help as parameter.

Thanks for the report. However, this is not a bug. See this related FAQ on the coreutils project:

http://www.gnu.org/software/coreutils/faq/#I-have-a-file-called-_003csamp_003e_003cspan-class_003d_0022option_0022_003e_002d_002dhelp_003c_002fspan_003e_003c_002fsamp_003e_002e-How-do-I-remove-it_003f

Use either one of these alternatives instead:

grep -R "any string" ./*
grep -R "any string" -- *

Or, for that matter, since * in a large directory may exceed command line length limits on many OS, you may even want to consider using:

grep -R "any string" .

although that will also visit hidden dot-files in the current directory.

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to