Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2018 22:15:48 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334190 - head/usr.bin/grep
Message-ID:  <201805242215.w4OMFm54044950@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Thu May 24 22:15:47 2018
New Revision: 334190
URL: https://svnweb.freebsd.org/changeset/base/334190

Log:
  Fix exit code for mismatches after r333013.
  
  The -c flag still does the wrong thing versus the older version due to
  lack of pipefail support.
  
  Reported by:	antoine

Modified:
  head/usr.bin/grep/zgrep.sh

Modified: head/usr.bin/grep/zgrep.sh
==============================================================================
--- head/usr.bin/grep/zgrep.sh	Thu May 24 21:38:18 2018	(r334189)
+++ head/usr.bin/grep/zgrep.sh	Thu May 24 22:15:47 2018	(r334190)
@@ -138,19 +138,21 @@ then
     fi
 fi
 
+ret=0
 # call grep ...
 if [ $# -lt 1 ]
 then
     # ... on stdin
-    ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" -
+    ${cattool} ${catargs} - | ${grep} ${grep_args} -- "${pattern}" - || ret=$?
 else
     # ... on all files given on the command line
     if [ ${silent} -lt 1 -a $# -gt 1 ]; then
 	grep_args="-H ${grep_args}"
     fi
     for file; do
-	${cattool} ${catargs} -- "${file}" | ${grep} --label="${file}" ${grep_args} -- "${pattern}" -
+	${cattool} ${catargs} -- "${file}" |
+	    ${grep} --label="${file}" ${grep_args} -- "${pattern}" - || ret=$?
     done
 fi
 
-exit 0
+exit ${ret}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805242215.w4OMFm54044950>