From 4962e55522a41562a00e8a881ce7b2427564a6dd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 10 Nov 2010 00:57:49 -0800 Subject: [PATCH] zgrep: don't assume traditional behavior with signal numbers * zgrep.in: Don't assume the exit status is the signal number plus 128, as POSIX doesn't require this. No need to kill self; exiting with large status is enough. Propagate all exit statuses greater than 1, not merely those in the range 129..143, as there's no need to treat that range specially (and it's not portable anyway). --- zgrep.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zgrep.in b/zgrep.in index 68396db..d0dea15 100644 --- a/zgrep.in +++ b/zgrep.in @@ -210,14 +210,11 @@ do (eval "$grep" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&- ) && exit $r r=$? - test $r -gt 128 && test $r -le 143 && exit $r || exit 2 + test 1 -lt $r && exit $r || exit 2 fi >&3 5>&- ) r=$? - if test $r -gt 128 && test $r -le 143; then - kill -$(($r-128)) $$ - exit $r - fi + test 128 -lt $r && exit $r test "$gzip_status" -eq 0 || test "$gzip_status" -eq 2 || r=2 test $res -lt $r && res=$r done -- 2.30.2