svn commit: r334190 - head/usr.bin/grep

Bryan Drewery bdrewery at FreeBSD.org
Thu May 24 22:15:48 UTC 2018


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}


More information about the svn-src-head mailing list