grep is always recursive

Derek Broughton derek at pointerstop.ca
Wed Jan 28 17:18:19 UTC 2009


Smoot Carl-Mitchell wrote:

> On Tue, 2009-01-27 at 23:19 -0400, Derek Broughton wrote:
> 
>> You _could_ easily enough - you just say that the first non-option
>> argument
>> terminates reading of options (just like -- does).  I should think you
>> could even drop a modified getopt onto your system that does that.
> 
> Will not work in all cases.  Suppose you have a directory with a file
> called '-i'.  Then running ls with
> 
> ls *
> 
> will be the same as running
> 
> ls -i

You're right, of course.  Such a getopt would handle most cases (and in fact 
would be the same as setting the POSIXLY_CORRECT environment variable, so 
obviously unnecessary :-) ) but would still go wrong occasionally.






More information about the ubuntu-users mailing list