How to disable `alt-numkey` in bash shell

bashbashrcinputrcreadline

I can bounce between apps in Chrome OS by pressing alt-N, where N is the position of my app on the status bar. Useful!

But when I'm in the bash shell of my Nitrous.io box, pressing alt-N to bounce to a different app gives bash a command: (arg: N).

What does the (arg: N) command do in bash? A five minute search taught me plenty of hotkeys, but none with alt + number key.

And can I disable it?

Best Answer

You can remove them in an exactly same way as any other shortcut – with bind -r

for i in "-" {0..9}; do bind -r "\e$i"; done

If you hate loops, you may do it manually:

bind -r '\e-'
bind -r '\e0'
bind -r '\e1'
bind -r '\e2'
bind -r '\e3'
bind -r '\e4'
bind -r '\e5'
bind -r '\e6'
bind -r '\e7'
bind -r '\e8'
bind -r '\e9'

If you do not want this modifiers not only in Bash sessions but everywhere where GNU Readline provides them, add the following lines not in your .bashrc but in your .inputrc:

"\e-"
"\e0"
"\e1"
"\e2"
"\e3"
"\e4"
"\e5"
"\e6"
"\e7"
"\e8"
"\e9"

(Yes, just list them).

Related Question