summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-07-12 00:50:54 +0200
committerMark Wielaard <mark@klomp.org>2019-07-12 00:50:54 +0200
commit33414da1d2bedf2cbe693f0e21fdaef11d221b1d (patch)
treece0f7bb6531df982a14205fe0e2e8d4810216105
parentfix bzdiff when TMPDIR contains spaces (diff)
downloadbzip2-33414da1d2bedf2cbe693f0e21fdaef11d221b1d.tar.gz
bzip2-33414da1d2bedf2cbe693f0e21fdaef11d221b1d.tar.bz2
bzip2-33414da1d2bedf2cbe693f0e21fdaef11d221b1d.tar.xz
Fix bashism in bzgrep
bzgrep uses ${var//} which is a bashism. Replace by calling sed so other POSIX shells work. Patch from openSUSE by Led <ledest@gmail.com>
-rw-r--r--bzgrep4
1 files changed, 1 insertions, 3 deletions
diff --git a/bzgrep b/bzgrep
index 9a04b83..5080afd 100644
--- a/bzgrep
+++ b/bzgrep
@@ -63,9 +63,7 @@ for i do
63 bzip2 -cdfq "$i" | $grep $opt "$pat" 63 bzip2 -cdfq "$i" | $grep $opt "$pat"
64 r=$? 64 r=$?
65 else 65 else
66 j=${i//\\/\\\\} 66 j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
67 j=${j//|/\\|}
68 j=${j//&/\\&}
69 j=`printf "%s" "$j" | tr '\n' ' '` 67 j=`printf "%s" "$j" | tr '\n' ' '`
70 bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" 68 bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
71 r=$? 69 r=$?