grep is always recursive

Lorenzo Luengo lluengo at dgeo.udec.cl
Thu Jan 29 04:34:18 UTC 2009


Matthew Flaschen wrote:
> 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...
>>     
>
> It's a "design decision", and it's not going to be changed any time soon
> (READ: ever).  However, the given workarounds do work reliably.
>
> $ grep "lala" *
>
> $ grep -- "lala" *
>
> will cause the option-looking directory to be ignored.
>
>   
This makes me think of those poor bash script developers that don't know 
which filenames they will be handling... I think that a good fix to this 
problem could be adding an option like"--files=*", that handles a 
regular expression for filtering files.

Do you think of it to be a good idea?

-- 
Lorenzo Luengo Contreras
Administrador de Sistemas DGEO
Universidad de ConcepciĆ³n
ConcepciĆ³n - Chile
+56-41-2207277





More information about the ubuntu-users mailing list