[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature-request: don't count history time comment lines when in HIST
From: |
Chet Ramey |
Subject: |
Re: feature-request: don't count history time comment lines when in HISTFILESIZE |
Date: |
Wed, 25 Mar 2015 16:19:13 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 3/25/15 3:02 PM, Christoph Anton Mitterer wrote:
> 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'
Here's what happens. The history timestamp code depends on the setting of
the history `comment character' -- that's the `#' that it uses to denote
the start of a timestamp entry. The history comment character disables
history expansion for every subsequent character on a line.
When you start bash, and source your .bashrc, the history comment character
is not set. You haven't set it in .bashrc, I assume, and it doesn't
acquire its default value until later on in the interactive shell
initialization process. Since that's not set, the lines beginning with
`#[digit]' are not recognized as timestamps and treated as ordinary history
entries.
You can fix this by assigning to histchars before setting HISTFILESIZE:
histchars='!^#'
Those are the defaults.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, (continued)
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Chet Ramey, 2015/03/25
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/25
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Chet Ramey, 2015/03/25
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/25
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Chet Ramey, 2015/03/26
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Eric Blake, 2015/03/26
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Chet Ramey, 2015/03/26
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/26
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/26
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Chet Ramey, 2015/03/27
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE,
Chet Ramey <=
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/25
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Chet Ramey, 2015/03/26
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/26