[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command history with several shell instances
From: |
Chet Ramey |
Subject: |
Re: Command history with several shell instances |
Date: |
Fri, 13 Dec 2019 15:02:49 -0500 |
> >>
> >> I have a question on how Bash handles preserving the command history in
> >> ~/.bash_history when several shell instances are used in parallel. I was
> >> expecting the history file to be overwritten every time a shell instance
> >> is terminated because bash(1) says:
> >>
> >> If the histappend shell option is enabled (see the description of shopt
> >> under SHELL BUILTIN COMMANDS below), the lines are appended to the
> >> history file, otherwise the history file is overwritten.
> >
> > Bash manages its per-shell-instance history list in memory. It reads from
> > the history file at startup and writes to it on exit.
> >
> > The histappend option operates when the shell writes the history at exit.
>
> Right. This is why, in my tests, I first got rid of all Bash command
> history in the "Alice" session (including the history file) and then
> started the "Bob" session in parallel to "Alice", so both would have no
> command history at all.
You're right. I overlooked the "close windows" part. My fault.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://tiswww.cwru.edu/~chet/