[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash history search key binding



Lei Kong wrote:

[...]

Thanks for your advice, but misteriously, it is back to normal now.
I swear to god I didn't do anything, oh, wait, maybe I did an aptitude upgrade
without even knowing about it.

maybe your bash history was accidentally reset.. or lost its cd* commands .. maybe the keyboard stopped sending the correct keycodes.. maybe your machine is infected by some bash-bashing trojan.. ;-)

BTW, I wasn't talking about the default bash key binding.

I was just noting that you had reassigned one of the defaults to a different editing command.. I've given it a try and now it makes sense.

I don't know the official name, it works like this:
enter a word, say "cd" in a bash shell, then press
up and down key will walk you through all previous commands

this may be a lead.. in effect if you enter 'cd' and hit the up-arrow it will display the cd commands in your current history.. but according to the man page what it does is an incremental backward search looking for the string 'cd'.. which is not exactly the same thing.. what I'm saying is that although it amounts to the same thing under most circumstances it does something slightly different in essence.. so depending on precisely what you did - of which I am not aware - this might give you a clue as to what might have been going on.

that start with "cd" one by one. This is more efficient
than the default behavior of up/down key binding, which
shows you the whole command history one by one.

definitely is.. but I'm so used to CTRL-R - which roughly provides the same functionality and has the additional advantage that you do not have to move your hand to those hard-to-reach arrow keys that it's probably too late to change my working habits.. After playing with it for a little while I'm curious why bash does not make it the history search default because it works in a manner that I find more natural than CTRL-R.. A bit like completion actions (tab etc....) - only it takes its inut from you current bash history.. Maybe I should try reassigning the backward search command to CTRL-R for a while and see if it has any limitations that I didn't notice while experimenting..

How did you find out about these two guys..?

Lei

If it happens again and you want to get to the bottom of this.. bash has its own mailing list and the folks there are both knowledgeable and very helpful.

Chris.



Reply to: