I enter:
ls /tmp
- wonderful. Now I wan't to enter
ls /temp
and can prevent it to enter the history, therefore prevent it to overwrite ls /tmp, if I start the command with a blank:
ls /temp
It's hard to see, but if you know it ...
It is controlled by
export HISTCONTROL=ignoredups
export HISTCONTROL=ignoreboth
ignoredups only ignores duplicated commands, ignoreboth ignores spaces at the beginning of line, which is useful, to hide otherwise unhidden passwords.
But maybe you're out for a solution, where you end with both commands, the unmodified old one, and the new one. My version of bash or settings behave like this, but I don't know, what's different to yours.