I'm on 10.1 and not yet ready to test 11.0rcN but maybe someone who has can help me out here: the latest NetBSD sh manual says
HISTAPPEND
If set to one of `true', `yes', `on', or an integral value
greater than zero, and if HISTFILE is also set, and is a valid
history file, then as commands are read and added to the his-
tory buffer, they are also written to the HISTFILE named.
HISTFILE
When assigned to in an interactive shell the contents of the
file named by expanding the new value of HISTFILE will, if it
exists, can be opened for reading, and is a suitable sh his-
tory file (one previously written by sh), be read into the
history buffer, appending its contents to any existing history
entries. If HISTFILE is set when sh exits, after any EXIT
trap has been evaluated, and if HISTAPPEND is not enabled, or
if HISTFILE is assigned when HISTAPPEND is enabled, or if
HISTAPPEND is enabled when HISTFILE is set, the contents of
the history buffer will be written to the file named after
expanding this variable. If the file named did not previously
exist, it will be created. If it did exist, it must be
writable. The file will be truncated, and then if owned by
the current user, the current history buffer will be written
to it.
(Apologies for the bogus syntax highlighting, but I didn't turn it on and don't see how to turn it off.)
The part that confuses and bugs me here is "the file will be truncated". Why would the file be truncated if HISTAPPEND is set? Does anyone know if this is a sort of misstatement in the man page or if that's actually what happens? (About 19 years ago, I started preserving all my bash commands on Linux and would like to be able to do the same with sh and/or ksh on NetBSD. As far as I know, it's essentially impossible with sh prior to 11.0, if it even is then and I've been learning about ksh lately, but haven't come across the history preservation parts yet - bonus points if anyone could tell me about that. (I could keep using bash, of course, but would like to see if I can live without it. 🙂 )
Anyway, in addition to the HIST* stuff, this thread could also be used for general "new sh version" discussion if anyone wanted to.