|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
bzgrep uses !/bin/sh but then uses the bashism ${var//} so replace those
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
with calls to sed so POSIX shells work
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
http://bugs.gentoo.org/193365
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
--- ./bzgrep
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
+++ ./bzgrep
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
@@ -63,10 +63,9 @@
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
r=$?
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
- j=${i//\\/\\\\}
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
- j=${j//|/\\|}
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
- j=${j//&/\\&}
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
- j=`printf "%s" "$j" | tr '\n' ' '`
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
+ # the backslashes here are doubled up as we have to escape each one for the
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
+ # shell and then escape each one for the sed expression
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
+ j=`printf "%s" "${i}" | sed -e 's:\\\\:\\\\\\\\:g' -e 's:[|]:\\\\|:g' -e 's:[&]:\\\\&:g' | tr '\n' ' '`
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
r=$?
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
854ef8 |
fi
|