do not escape \ in --line

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2014-01-07 22:30:59 +01:00
parent 71e5314ec1
commit f8c36c080e

View file

@ -49,7 +49,15 @@ case "$state_should" in
# Replace all \ so \t and other combinations are not interpreted # Replace all \ so \t and other combinations are not interpreted
# #
line_sanitised=$(cat "$__object/parameter/line" | sed -e "s/'/'\"'\"'/g" -e 's/\\/\\\\/g')
# line_sanitised=$(cat "$__object/parameter/line" | sed -e "s/'/'\"'\"'/g" -e 's/\\/\\\\/g')
# The one above does not work:
# --line "PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\w\\$ '"
# becomes
# PS1='[\\t] \\[\\033[1m\\]\\h\\[\\033[0m\\]:\\w\\$ '
# Only replace ' with '"'"' and keep \ as they are
line_sanitised=$(cat "$__object/parameter/line" | sed -e "s/'/'\"'\"'/g")
echo "printf '%s\n' '$line_sanitised' >> $file" echo "printf '%s\n' '$line_sanitised' >> $file"
;; ;;