fix issue: sed contains "&" sign

This commit is contained in:
neil 2016-01-07 22:49:43 +08:00
parent 2c03af204e
commit 23cb43c85f
1 changed files with 3 additions and 0 deletions

3
le.sh
View File

@ -196,6 +196,9 @@ _setopt() {
fi
if grep -H -n "^$__opt$__sep" "$__conf" > /dev/null ; then
_debug OK
if [[ "$__val" == *"&"* ]] ; then
__val="$(echo $__val | sed 's/&/\\&/g')"
fi
sed -i "s|^$__opt$__sep.*$|$__opt$__sep$__val$__end|" "$__conf"
else
_debug APP