Official request: Please make GNU grep the default

Dag-Erling Smørgrav des at des.no
Mon Aug 23 12:20:17 UTC 2010


"b. f." <bf1783 at googlemail.com> writes:
> Dag-Erling Smørgrav <des at des.no> writes:
> > "Does not seem to work properly" is not a very useful statement.  The
> > least you could do is provide an example.
> I did provide an example, later in the same sentence that you quoted.

I forgot to answer this part.  By example, I mean an actual grep command
line and sample input that demonstrates the problem, the smaller the
better:

% echo elisp lisp | grep -w lisp && echo good || echo bad
elisp lisp
good
% echo elisp lisp | grep -wq lisp && echo good || echo bad
bad

No idea what causes it, but a quick grep (hah!) for qflag turns up the
following horror:

        /* Find out the correct return value according to the
           results and the command line option. */
        exit(c ? (notfound ? (qflag ? 0 : 2) : 0) : (notfound ? 2 : 1));

which shows that -q *does* affect the exit code, but my brain refuses to
try to understand that code.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-current mailing list