Why does bash change the history even I'm not executing a command I'm modifying? For example, if I type:
$ echo foo1 foo1 $ echo foo2 foo2 $ echo foo3 foo3 After this, I press up twice, and I get echo foo2 on the prompt. I press 2 and get echo foo22. Now back to the end (empty line) with downdown. If I now search history, I'll see echo foo22 even though I've never executed that command!
However, when I exit the shell and open another one, I see the original, executed commands. I find all this very confusing, counter-intuitive and irritating.
I'd like the history thing to work like this:
Only the commands actually executed are saved to the history.
History is immutable. (Unless explicitly cleared.)
Is there a way to accomplish this?
Edit - this question seems related: Is there any way to undo a bash history modification?Is there any way to undo a bash history modification?