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
This commit is contained in:
Bryan Drewery 2018-05-24 22:15:47 +00:00
parent d1f3fb2cb4
commit 920a817c78

View File

@ -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}