Several days ago, I had one Terminal tab doing
ssh, and the other doing a lot of work locally. And then I restarted the machine (on a Mac with Mavericks).
When I ran Terminal again, I found that all the command history of the 2nd tab was not there. There was only the
So then I searched for how to "merge" the history somehow, and found that we need to do a
shopt -s histappend in our
~/.bashrc file so that history will append, instead of "overwrite" -- we don't want one set of history overwriting the other set; we want to append.
However, when I go to the OS X Yosemite box, and used
shopt, I saw that
histappend is off, but when I opened up two tabs, one doing
echo abc, and the other doing
echo def, and exited them, I re-opened Terminal again and issued a
history command, and saw both the
echo abc and
echo def commands.
And then I ran Ubuntu 2014-10 on VirtualBox and did similar things, and still saw both history recorded (I first ran
shopt -u histappend in both Bash to set the option to off first).
So what mechanism is doing that really? Then
histappend has no significance, if setting it to on or off doesn't matter?
I also commented out the
shopt -s histappend in my
.bashrc and restarted Terminal and tried again, and saw the history of both tabs able to combine... so this is really strange behavior and what can be causing it?