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:
parent
d1f3fb2cb4
commit
920a817c78
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user