I mentioned the "by default" as a warning. My .bashrc sets HISTFILE then does history -cr, but only if HISTFILE is set to the default, so that sub-shells in the same window use the same history.
I see in the bash doc there is shopt histappend "If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file." but I don't see a difference.
That's interesting, make bash behave like ksh, from nearly 30 years ago. I'll file that away.
I see in the bash doc there is shopt histappend "If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file." but I don't see a difference.
Some net research suggests:
Code:
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
Comment