Re: feature-request: don't count history time comment lines when in HIST
From:
Christoph Anton Mitterer
Subject:
Re: feature-request: don't count history time comment lines when in HISTFILESIZE
Date:
Wed, 25 Mar 2015 20:02:13 +0100
On Wed, 2015-03-25 at 14:48 -0400, Chet Ramey wrote:
> The history file truncation code already skips lines that look like history
> timestamps. Look at history.c:history_truncate_file().
Ah? Hmm was that only recently introduced?
I'm having bash4.3 with patches up to including 33. And this time I
looked whether Debian added any of it's goodness ;-)
When I set e.g. in .bashrc:
HISTSIZE=50
HISTFILESIZE=50
HISTTIMEFORMAT=$'%c\t'
Then:
$ rm .bash_history
$ history -c
Then start a new shell and then enter commands
$ echo 1
$ echo 2
...
$ echo 50
When I do now a:
$ history
I see all the 50 (+/- 1)
But when I leave the shell and go into a new one:
$ histroy
gives me only about the last 25 (i.e. echo 27 to echo 50 + "history"),
and these are also the only entries in .bash_history, i.e.:
#1427309882
echo 27
#1427309882
echo 28
[snip snap]
#1427309882
echo 50
#1427309884
history
Cheers,
Chris.