Red Hat Bugzilla – Bug 104867
zgrep reports incorrect return codes when grepping /dev/null
Last modified: 2007-04-18 12:57:42 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; Linux i686; U) Opera 7.20 [en]
Description of problem:
When doing something like
zgrep foo /dev/null
I expect the same return code as
grep foo /dev/null
which returns 1, but I get 0.
This is because the return code of grep isn't scrutinised directly, only the
return code of the sed command into which grep's output is piped. Oops. Not
being a shell expert I've not yet come up with a decent fix; sorry.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. grep foo /dev/null; echo $?
2. zgrep foo /dev/null; echo $?
Actual Results: 1
Expected Results: 1
In gzip-1.3.3-13 zgrep works correctly.