mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Scripts: Better fix for xzgrep.
Now it uses "grep -q". Thanks to Gregory Margo.
This commit is contained in:
parent
2118733045
commit
40277998cb
1 changed files with 6 additions and 2 deletions
|
@ -126,6 +126,10 @@ while test $# -ne 0; do
|
||||||
grep="$grep $option$optarg"
|
grep="$grep $option$optarg"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test $files_with_matches -eq 1 || test $files_without_matches -eq 1; then
|
||||||
|
grep="$grep -q"
|
||||||
|
fi
|
||||||
|
|
||||||
eval "set -- $operands "'${1+"$@"}'
|
eval "set -- $operands "'${1+"$@"}'
|
||||||
|
|
||||||
if test $have_pat -eq 0; then
|
if test $have_pat -eq 0; then
|
||||||
|
@ -157,9 +161,9 @@ for i; do
|
||||||
exec 5>&1
|
exec 5>&1
|
||||||
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
||||||
if test $files_with_matches -eq 1; then
|
if test $files_with_matches -eq 1; then
|
||||||
eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; }
|
eval "$grep" && { printf '%s\n' "$i" || exit 2; }
|
||||||
elif test $files_without_matches -eq 1; then
|
elif test $files_without_matches -eq 1; then
|
||||||
eval "$grep" >/dev/null || {
|
eval "$grep" || {
|
||||||
r=$?
|
r=$?
|
||||||
if test $r -eq 1; then
|
if test $r -eq 1; then
|
||||||
printf '%s\n' "$i" || r=2
|
printf '%s\n' "$i" || r=2
|
||||||
|
|
Loading…
Reference in a new issue