Bind commands in .bash files don't play nice with Dreamhost logins

Recently I posted a link to some code highlights: Auto populate from History via up and down arrow keys.
I’ve been using that code for several years in a number of bash terminals; on my Mac, several RedHat 5 & 6 Linux servers and on a few hosting accounts on Dreamhost.

One small piece of that code no longer plays nice with Dreamhost.
Something changed on the server-side that is in conflict with 1 or 2 lines of code so that users can not SFTP into the server with a valid user name and password. Authentication with ssh keys however continues to work.

Here’s the offending code found in my .bashrc file:
bind ‘”e[A”‘:history-search-backward
bind ‘”e[B”‘:history-search-forward

Those two lines are the key in this tip: Auto populate from History via up and down arrow keys and this code’s been in use for years on this server. So something funky’s going on.

Anyhow solutions are the order of the day and I found one thanks to a post on my-guides.net. I learned that there’s an alternative to binding keys in your .bashrc file; that is, you can use an .inputrc file and lose the ‘bind’ command. Worked like a charm!

So I removed the offending code from in my .bashrc file and added my lines (plus several more) to a new .inputrc file:
# search history via up and down arrow keys
“e0A”: history-search-backward
“e[A”: history-search-backward
“e0B”: history-search-forward
“e[B”: history-search-forward
“e0C”: forward-char
“e[C”: forward-char
“e0D”: backward-char
“e[D”: backward-char

Hooray!
I’ll have to test this solution on my mac and RedHat boxes but if it works, I’ll be updating my repository with the new file and updated code.

Keep calm and code on.

Leave a Comment