help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] History always appended even though histappend set to off


From: john smith
Subject: [Help-bash] History always appended even though histappend set to off
Date: Wed, 4 May 2016 09:16:49 +0200

When I start bash with --norc histappend is set to off as expected:

$ shopt | grep histappend
histappend      off

After starting bash with --norc in two different terminal windows I
expect only history of the last closed window to be saved.
However, I always end up with history from both windows saved in
~/.bash_history after exiting as if histappend was set.  I checked
the source code and the reason for this behavior is in
maybe_save_shell_history() in this line:

if (history_lines_this_session <= where_history () || force_append_history)

The first condition is always true.  I added printing value of
history_lines_this_session and where_history() before exitting:

$ ./bash --norc
bash-4.3$ echo hi
hi
bash-4.3$ exit
exit
Will append
history_lines_this_session: 2
where_history(): 6

What is going on here?  In what circumstances does histappend work?
-- 
<address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]