Perform cleaninput() escaping without sed.
No need for invoking sed; Bash's global pattern substitution can be used.
This commit is contained in:
committed by
Gina Trapani
parent
a4db95166d
commit
e79b1629f5
6
todo.sh
6
todo.sh
@@ -274,8 +274,10 @@ cleaninput()
|
|||||||
if [ "$1" = "for sed" ]; then
|
if [ "$1" = "for sed" ]; then
|
||||||
# This action uses sed with "|" as the substitution separator, and & as
|
# This action uses sed with "|" as the substitution separator, and & as
|
||||||
# the matched string; these must be escaped.
|
# the matched string; these must be escaped.
|
||||||
# Backslashes must be escaped, too.
|
# Backslashes must be escaped, too, and before the other stuff.
|
||||||
input=`echo $input | sed -e 's+\\\+\\\\\\\\+g' -e 's/\&/\\\&/g' -e 's/|/\\\\|/g'`
|
input=${input//\\/\\\\}
|
||||||
|
input=${input//|/\\|}
|
||||||
|
input=${input//&/\\&}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user