10.6 bash history-search-backwards
10.6 broke my terminal history search
In 10.4 I added
bind '"M-[A": history-search-backward'
bind '"M-[B": history-search-forward'
to my .bash_profile allowing me to use the up/down arrows to search through the history in terminal, but as of 10.6 this no longer works.
I would like the up and down arrows to perform a search of the history for the string I have typed in the terminal. That is if I had issued the following sequence of commands in the terminal,
$cd ~/
$nano .bash_profile
$vi .bash_profile
so now these commands are sequentially listed in my bash history. Now if I press the up arrow, the first command to come up will be the last one that I entered, that is, $vi .bash_profile. Now if I had instead pressed up three times, the command, $cd ~/ would come up. Now what I want bash to do, and had working in OS X 10.4, is if I type a string into the terminal (and DO NOT press ENTER) such as, $cd , then I press up, bash will search through the terminal history for the instances of the command cd that I have previously entered. This is the same behavior as the MATLAB command prompt.
I know this is possible because it used to work. I would like to have this behavior again because it is very useful. I do know that I can use crl-R to search the history, but this is kind of a pain to use and it doesn't work very well.
I added the above code to ~/.inputrc and now if I type the letter 'b' in terminal I get the output
{quote}
"": history-search-forward
{quote}
It only does this for the the letter 'b'. I have tried all the other keys and there is no weird output. What is up with bash?
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Also see threads:
http://forums.macosxhints.com/showthread.php?p=569961#post569961 Mac OS X Hints 10.6 bash history-search-backwards
http://www.macosxhints.com/article.php?story=20031026174236860 Mac OS X Hints 10.3: Assign arrow keys to history search in bash
Mac Book Pro, Mac OS X (10.6.2)