Perform cleaninput() escaping without sed.

No need for invoking sed; Bash's global pattern substitution can be used.
This commit is contained in:
Ingo Karkat
2011-05-31 15:28:46 +02:00
committed by Gina Trapani
parent a4db95166d
commit e79b1629f5

View File

@@ -274,8 +274,10 @@ cleaninput()
if [ "$1" = "for sed" ]; then
# This action uses sed with "|" as the substitution separator, and & as
# the matched string; these must be escaped.
# Backslashes must be escaped, too.
input=`echo $input | sed -e 's+\\\+\\\\\\\\+g' -e 's/\&/\\\&/g' -e 's/|/\\\\|/g'`
# Backslashes must be escaped, too, and before the other stuff.
input=${input//\\/\\\\}
input=${input//|/\\|}
input=${input//&/\\&}
fi
}