public inbox for
 help / color / mirror / Atom feed
* [PATCH] Fix bashism in bzgrep
@ 2019-01-01  0:00 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2019-01-01  0:00 UTC (permalink / raw)
  To: bzip2-devel
  Cc: Martin Pluskal, Bjørn Lie, Kristýna Streitová,
	Led, Mark Wielaard


bzip2 lost its domain and got a new home at
It also didn't see a release for a very long time. Causing various patches
used by distros to not have been integrated upstream. We are trying to
collect them all and do a new release.

The following patch comes from openSUSE.
Please let us know if we missed some others.



bzgrep uses ${var//} which is a bashism.
Replace by calling sed so other POSIX shells work.

Patch from openSUSE by Led <>
 bzgrep | 4 +---
 1 file changed, 1 insertion(+), 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"
-    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}:|"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-11 23:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [PATCH] Fix bashism in bzgrep Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).