grep is always recursive
derek at pointerstop.ca
Wed Jan 28 01:49:22 UTC 2009
Hal Burgiss wrote:
> On Tue, Jan 27, 2009 at 05:45:35PM -0300, Lorenzo Luengo wrote:
>> mv ./-r ./.-r
>> $ grep "lala" *
>> 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..
It's certainly not a bash problem. bash expansion _must_ expand all globs.
I don't consider it a bug at all, difficult as it is. Who in their right
minds creates file names with anything but a leading alpha character? Sorry,
but that's just asking for trouble.
>> Should it be reported to anyone?
> At the least I'd say there is a documentation bug that shows options
> clearly coming before filenames.
That's just standard man page construction. How else do you simply show
that options and other arguments can be interspersed?
> And it is worth documenting that if
> the intended behavior is for filenames expanded from the shell to be
> interpreted as options. Those both strike me as grep issues.
As somebody else pointed out it's the Gnu option processor, so anything that
uses it (most programs) will have the same issues. Should all of them
explicitly mention that in their man pages? I don't think so.
More information about the ubuntu-users