| Index: src/scripts/xzgrep.in
|
| ===================================================================
|
| --- src/scripts/xzgrep.in (revision 50504)
|
| +++ src/scripts/xzgrep.in (working copy)
|
| @@ -27,7 +27,7 @@
|
| xz='@xz@ --format=auto'
|
| unset GZIP BZIP BZIP2
|
|
|
| -case ${0##/*} in
|
| +case ${0##*/} in
|
| *egrep*) prog=xzegrep; grep=${GREP:-egrep};;
|
| *fgrep*) prog=xzfgrep; grep=${GREP:-fgrep};;
|
| *) prog=xzgrep; grep=${GREP:-grep};;
|
| @@ -35,7 +35,7 @@
|
|
|
| version="$prog (@PACKAGE_NAME@) @VERSION@"
|
|
|
| -usage="Usage: ${0##/*} [OPTION]... [-e] PATTERN [FILE]...
|
| +usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| Look for instances of PATTERN in the input FILEs, using their
|
| uncompressed contents if they are compressed.
|
|
|
| @@ -126,6 +126,10 @@
|
| grep="$grep $option$optarg"
|
| done
|
|
|
| +if test $files_with_matches -eq 1 || test $files_without_matches -eq 1; then
|
| + grep="$grep -q"
|
| +fi
|
| +
|
| eval "set -- $operands "'${1+"$@"}'
|
|
|
| if test $have_pat -eq 0; then
|
| @@ -156,9 +160,9 @@
|
| exec 5>&1
|
| ($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| if test $files_with_matches -eq 1; then
|
| - eval "$grep" -q && { printf '%s\n' "$i" || exit 2; }
|
| + eval "$grep" && { printf '%s\n' "$i" || exit 2; }
|
| elif test $files_without_matches -eq 1; then
|
| - eval "$grep" -q || {
|
| + eval "$grep" || {
|
| r=$?
|
| if test $r -eq 1; then
|
| printf '%s\n' "$i" || r=2
|
|
|