How to bind Shift-Tab keyboard shortcut to an action in Bash?

I tried to discover key code of Shift-Tab combination by

# sed -n l


# read a ; echo $a | hexdump -cC
0000000 033   [   Z  \n
00000000  1b 5b 5a 0a                                       |.[Z.|

Based on that I assume the key code is \e[Z. So bind "\e[Z":menu-complete-backward should do the trick. However it binds the action to \.

$ bind -p > bind.before
$ bind "\e[Z":menu-complete-backward
$ bind -p > bind.after
$ diff -y  --suppress-common-lines bind.before bind.after
# menu-complete-backward (not bound)                          | "\\": menu-complete-backward
"\\": self-insert                                             <

1 Answer 1


Try single-quoting the parameter:

bind '"\e[Z":menu-complete-backward'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .