grep is always recursive

Matthew Flaschen matthew.flaschen at
Wed Jan 28 02:16:53 UTC 2009

Smoot Carl-Mitchell wrote:
> On Tue, 2009-01-27 at 17:45 -0300, Lorenzo Luengo wrote:
>> The problem comes from the bash * expansion that makes grep see that 
>> filename as an option. Is it a bash problem? Is it a grep problem?? 
>> Don't know...
>> Should it be reported to anyone?
> The root of the problem is the getopt function in the C library which is
> the standard way of doing option processing in C programs.
> The glob shell expansion of '*' is correct.

Given the way the shell does expansion, and the way arguments are passed
to C programs, how would you design get opt to eliminate this problem?
I don't think it's possible to "fix" this in getopt (which is not used
by all C programs anyway)

Matt Flaschen

More information about the ubuntu-users mailing list