Fix .term bindings for commands with embedded ".
authorEric Blake <eblake@redhat.com>
Thu, 24 Oct 2019 02:25:04 +0000 (21:25 -0500)
committerEric Blake <eblake@redhat.com>
Thu, 24 Oct 2019 02:29:01 +0000 (21:29 -0500)
The history file was correct (using reverse search or up arrow), but
the key binding needs injected escapes to have correct syntax.

2019-kvm-forum/functions

index 7baaed0..99c033b 100644 (file)
@@ -29,7 +29,8 @@ keys=(- OP OQ OR OS '[15~' '[17~' '[18~' '[19~' '[20~' '[21~')
 remember ()
 {
     echo "$@" >> $HISTFILE
-    echo \"\\e${keys[$fnum]}\":\"\\C-k \\C-u"$@"\" >> $talkdir/bindings
+    echo "$@" | sed -e 's/"/\\"/g; s/$/"/' \
+        -e 's/^/"\\e'"${keys[$fnum]}"'":"\\C-k \\C-u/' >> $talkdir/bindings
     ((fnum++))
 }