aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-03-24 01:21:32 +0200
committerLasse Collin <lasse.collin@tukaani.org>2011-03-24 01:21:32 +0200
commitc7210d9a3fca6f31a57208bfddfc9ab20a2e097a (patch)
tree2e7f705d2eddf845fd1e37d9809048a5ad6f40f8 /src
parentScripts: Add lzop (.lzo) support to xzdiff and xzgrep. (diff)
downloadxz-c7210d9a3fca6f31a57208bfddfc9ab20a2e097a.tar.xz
Scripts: Fix xzgrep -l.
It didn't work at all. It tried to use the -q option for grep, but it appended it after "--". This works around it by redirecting to /dev/null. The downside is that this can be slower with big files compared to proper use of "grep -q". Thanks to Gregory Margo.
Diffstat (limited to 'src')
-rw-r--r--src/scripts/xzgrep.in4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in
index 84df94b7..7ab617b9 100644
--- a/src/scripts/xzgrep.in
+++ b/src/scripts/xzgrep.in
@@ -157,9 +157,9 @@ for i; do
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" >/dev/null && { printf '%s\n' "$i" || exit 2; }
elif test $files_without_matches -eq 1; then
- eval "$grep" -q || {
+ eval "$grep" >/dev/null || {
r=$?
if test $r -eq 1; then
printf '%s\n' "$i" || r=2