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

RE: A note on the use of grep [WAS: Re: HELP! My printer won't stop!!]

roberto@familiasanchez.net wrote:
> A quick note.  If you are grepping the output of a ps command,
> enclose the first character of your regexp in square brackets.  For
> example:
> ps aux | grep [l]pr
> This still lists all the processes that contain the string "lpr", but
> it will not match the grep process itself anymore.

Why is that?  Isn't a bracket expression containing only one character exactly the
same as the character by itself?  Am I missing something blindingly obvious? :)

Reply to: