On Fri, Oct 13, 2000 at 05:51:22AM -0400, Rob Reid <[EMAIL PROTECTED]> wrote:
> It works, but I don't understand why. Shouldn't 'r[e]almutt' just parse to
> "realmutt"?
Yes, it's the same as matching with the regex 'realmutt'. However,
the grep process will appear in the ps listing as "grep r[e]almutt",
which doesn't match the regex because of the square brackets.
> And just to play devil's advocate: Which costs more: | grep -v grep or
> the difference between grep regex and grep plain_old_string?
I'd still have to say the extra process caused by "grep -v grep".
Unless grep has some short-circuit check enabled, I'm guessing it still
makes calls to regcomp and regexec in either case, and the performance
probably doesn't vary that much.
That said, I've alway used "grep -v grep", and unless you are
calling this repeatedly, it's unlikely you'll see a difference in
practice.
--
Bob Bell <[EMAIL PROTECTED]>
-------------------------------------------------------------------------
"Felten, who examined the secret "source code" for Windows 98 under
a court order, said he had found 3,000 bugs marked by Microsoft
programmers in the portion of Windows 98 he had examined -- and he
had looked at only one-seventh of it."
-- http://www.zdnet.com/zdnn/stories/news/0,4586,2273581,00.html