On Tue, 2023-04-11 at 13:06 -0400, Chris Murphy wrote:
On Tue, Apr 11, 2023, at 12:07 PM, Adam Williamson wrote:
> I've been doing something like this for years, but I wouldn't
> necessarily recommend it as an OOTB default. It has some interesting
> subtleties, like the order of the command history you get when you hit
> 'up' changes depending on when the history is updated by other
> terminals and when the terminal you're in reloads it.
I'm not seeing this effect. While active, the shells apparently have completely
unique histories, and don't interact with each other (until they're closed). From
time to time I see zero length files, e.g. .bash_history-04863.tmp appear but I don't
know what they do, there's nothing in them.
The version I use is a file in /etc/profile.d that does this:
HISTSIZE=1048576
HISTFILESIZE=1048576
LAST_HISTORY_WRITE=$SECONDS
function prompt_command {
if [ $(($SECONDS - $LAST_HISTORY_WRITE)) -gt 60 ]; then
history -a && history -c && history -r
LAST_HISTORY_WRITE=$SECONDS
fi
}
PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; prompt_command"
so I guess that's the difference; mine clears and reloads the history
(if it's been more than 60 seconds since the last time it did it).
--
Adam Williamson (he/him/his)
Fedora QA
Fedora Chat: @adamwill:fedora.im | Mastodon: @adamw(a)fosstodon.org
https://www.happyassassin.net