Bash readline delete key

Anyone get the keyboard Delete key to work with bash readline? When I tap the Delete key, I get the escape sequence. Please see the example below.

===> select a in dog cat cow; do echo "$REPLY" "$a"; done
1) dog
2) cat
3) cow
#? abcd^[[3~^[[3~
===> grep del /etc/inputrc 
"\e[3~": delete-char

===> echo $TERM
xterm-256color

===> set -o | egrep '^(emacs|vi)'
emacs          	on
vi             	off

# echo ' Ctrl V and hit Delete key
===> echo '^[[3~   

It depends on which terminal-emulator you use, but adding this should work:

.zshrc

bindkey "^[[3~" delete-char

.bashrc

bind "^[[3~"=delete-char-forward
2 Likes