[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problem with grep ?



On Sun, Jul 08, 2001 at 03:29:20PM +0200, Dominique Deleris wrote:
> joost@topaz.mdcc.cx (Joost Kooij) writes:
> 
> > No.  It appears to work fine, here.
> > 
> > $ type grep
> > grep is hashed (/bin/grep)
> 
> This is it ! Some days ago, I put an alias in my .bashrc as
> follows:
> alias grep='grep -l'
> 
> Commenting out this alias makes everything work fine again. I
> simply did not remember having set this alias :-)
> 
> Anyhow, what's wrong with this alias ?

The grep(1) manpage:

       -l, --files-with-matches
              Suppress normal output; instead print the name of each 
              input file from which output would normally have been
              printed.  The scanning will stop on the first match.

As you're pipe-ing data to grep -l, grep prints "standard input" as the
name of the "file".  It puts brackets around it, because it knows that
this is not a real file.

Cheers,


Joost



Reply to: