aboutsummaryrefslogtreecommitdiff
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
parentf7d209bfde37cf337f769531f9c7a29b8bb6ae7f (diff)
downloadbzip2-33414da1d2bedf2cbe693f0e21fdaef11d221b1d.tar.gz
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
bzip2 -cdfq "$i" | $grep $opt "$pat"
r=$?
else
- j=${i//\\/\\\\}
- j=${j//|/\\|}
- j=${j//&/\\&}
+ j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
j=`printf "%s" "$j" | tr '\n' ' '`
bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
r=$?