I very frequently retrieve commands from my bash history (^R) and start modifying it to fit my current needs, but if I change my mind and break (^C) to cancel it altogether, whatever changes I made end up overwriting that original line in my ~/.bash_history.
How do I turn this feature off? I've accidentally overwritten a number of important entries with this before and want to put an end to that once and for all.
The bash versions I'm using are 5.2.37(2)-release on Arch GNU+Linux and 3.2.57(1)-release on OS X El Capitan (and it affects both).
-
1I haven't yet tested it, but the Unix & Linux answer Is there any way to undo a bash history modification? might help.Chester Gillon– Chester Gillon2025年11月15日 17:18:04 +00:00Commented Nov 15 at 17:18
-
1"a number of important entries" – If they are really important then you may like the "more complex solution" from this answer of mine.Kamil Maciorowski– Kamil Maciorowski2025年11月15日 17:21:08 +00:00Commented Nov 15 at 17:21