tech-userlevel archive

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

zgrep is broken + why is our grep GNU grep by default?



`zgrep -r pattern directory` does not work because zgrep ends up
running `zcat directory | grep ...`, which obviously makes no sense.

`zgrep -e foo -e bar file(s)` will disregard all but the first -e
option, the second "-e" and the "bar" are treated as files to search
in.  The first "-e pattern" on a zgrep command line will terminate
option parsing and treat anything following as files to search, so
`zgrep -i -e FOO file_containing_foo` is case-insensitive but
`zgrep -e FOO -i file_containing_foo` isn't.

Don't even think of attempting something like
`zgrep -ie FOO file_containing_foo`.

There are probably other issues with it, I have stopped investigating
as soon as I noticed that despite having what appears to be FreeBSD's
grep in usr.bin/grep, which even supports being run as zgrep, we
default to build our grep from external/gpl2/grep, i.e. GNU grep.

I'm wondering what's the deal with that...?  I'm inclined to build
my systems with MKBSDGREP=yes from now on, or is there a good reason
not to?

Timo Buhrmester


Home | Main Index | Thread Index | Old Index