Saturday 23 March 2019

Bash history editing unwanted


This happens. Typing:


$ qwer
$ asdf
$ zxcv

up-arrow twice, backspace, backspace, down-arrow twice, then:


$ history 4
519 qwer
520* as
521 zxcv
522 history 4

The star by 520 tells me it's an intended feature.


I do not know how to control this kind of history editing. It has been in the way many more times than it has helped me, and I would like to disable it.



Answer



This is handled by readline. To change it you need to add set revert-all-at-newline on to your /etc/inputrc (or ~/.inputrc) if you have it. Note that you don't even have to start a new subshell after modifying inputrc because you can invoke re-read-init-file function which is binded to Ctrl-x Ctrl-r by default:


$ bind -p | grep read
"\C-x\C-r": re-read-init-file

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...