bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in grep


From: Waclaw Kusnierczyk
Subject: Re: bug in grep
Date: Fri, 08 Oct 2010 10:37:12 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

On 10/08/2010 10:12 AM, Eric Blake wrote:
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.


... which you can avoid by explicitly specify you don't want to visit them:

    grep -R --exclude='.*' "any string" .

or even

    grep -R --exclude='.*' --exclude-dir='.?*' "any string" .

if you don't want grep to consider hidden dot directories either.

vQ






reply via email to

[Prev in Thread] Current Thread [Next in Thread]