Motivated by this question, can anyone explain the following behavior?
$ echo "-uus" | grep -wo '[0]*' && echo matched -uus matched $ echo "-uus" | grep -o '[0]*' && echo matched matched $ grep --version | sed 1q grep (GNU grep) 2.5.1
In particular, why does the second grep succeed, but generate no output? And why does the first command have two lines of output? I can understand the second line of output, but I do not understand the first.
There were bugs in the older versions of
grep. I reported one here:https://bugzilla.redhat.com/show_bug.cgi?id=144980
Newer versions of
grepdo not exhibit the problem anymore.