Subject: Re: bug#17494: grep bug report: "GREP_OPTIONS" allows a user to break shell script

From: "Nadav Har'El" <[email-masked]>
Date: Thu, 15 May 2014 16:02:02 +0300

On Thu, May 15, 2014 at 3:53 PM, Norihiro Tanaka <[email-masked]> wrote:

>
> Even if I define an alias "grep='grep -d skip'", when "find . | xargs grep"
> doesn't ignore directories.
>

Since find does output directories, and clearly you don't want to grep on
them, why not just do something like

find . ! -type d | xargs grep

To be even safer and work with any file name (containing even newlines),
you actually need to do

find . ! -type d -print0 | xargs -0 grep

So maybe you just want to alias this whole thing :-)

I don't think this a reason to keep GREP_OPTIONS, but like I said I don't
mind if it is kept if at least people are warned about how it might break
shell scripts.

-- 
Nadav Har'El
[email-masked]