I just want the .bash_history file to store a lot of history, like $HISTSIZE=10000000, $HISTFILESIZE=10000000 which I have set months ago.
It does not work. I just tried ^R <some old command>, no way: my history file is now at 100324 bytes.
I have a single history for all sessions. I guess it is related to the problem: some race conditions, whatever. So I tried multiple recipes for a common bash history. Now I have this one:
HISTSIZE=10000000
HISTFILESIZE=$HISTSIZE
HISTCONTROL=ignorespace:ignoredups
history() {
_bash_history_sync
builtin history "$@"
}
_bash_history_sync() {
builtin history -a #1
HISTFILESIZE=$HISTSIZE #2
builtin history -c #3
builtin history -r #4
}
PROMPT_COMMAND=_bash_history_sync
Do not ask me what it means. It is just another copy&paste in a hope that the history file won't repeatedly lose contents despite the large limits.
Question: how to have both common history across sessions and $HISTSIZE, $HISTOFILESIZE be the only ultimate limits of history size, nothing else trying to help them?
shopt -s histappendandbuiltin history -a?