LFS does not save bash history on shutdown
msbREMOVE-THIS at winterdrache.de
Sat Jun 17 00:00:09 PDT 2006
On Tue, 13 Jun 2006 12:23:03 -0600 Jason Aeschilman
<jason-lists at fatpipeinc.com> wrote:
> Bash history is not saved on shutdown. I have commented out the line
> "unset HISTFILE" from /etc/profile so now history is saved for root, but
> it only works when I log out of a terminal. If I reboot or shutdown,
> the history does not get saved to ~/.bash_history. Does anyone know how
> this can be fixed? Shouldn't this be standard on the LFS system? Even
> if you keep "unset HISTFILE" for root, regular users should not lose
> their bash history on shutdown.
Are you sure that you are losing history rather than getting the history
for some interactive shell that you had open but didn't use?
AFAIK, by default, bash overwrites the history file on exit, i.e. the last
shell that terminates gets to write the history. When you shut down,
shells terminate in no well-defined order so that with
history-overwriting, the shell that wins the race to write history may
just be the wrong one.
shopt -s histappend
into your /etc/profile and see if that fixes your problem. This will cause
bash to append to the history file rather than overwrite it, thereby
causing your history to store history from all shells, not just the one
The 1st rule of the Internet: Never trust the Internet.
More information about the blfs-support