[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: |
Thu, 26 Mar 2015 16:26:31 -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 8:06 PM, Christoph Anton Mitterer wrote:
> On Wed, 2015-03-25 at 16:19 -0400, Chet Ramey wrote:
>> When you start bash, and source your .bashrc, the history comment character
>> is not set. You haven't set it in .bashrc, I assume
> Yes, I haven't.
>
>> 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='!^#'
> Okay that works in principle.
>
> But a) this means truncation of the history file happens immediately
> each the HISTFILESIZE is set and not just when the shell quits, right?
Yes.
> And b) it seems kinda ugly that one needs to explicitly set a default
> value that would be set later anyway.
Maybe. It is what it is, and it's an effective workaround that you can
use today.
> Wasn't it possible to simply set the default for histchars earlier in
> the startup?
histchars defaulting is part of the interactive shell setup; environment
variables are scanned before any other setup so they are available when
the startup files are read. The interactive shell startup comes after
the startup files are read so the startup files can set any appropriate
variables.
> Apart from that, it's not really directly obvious that histchars also
> affects the history itself and not just history expansion.
> E.g. it's normally not even set in my shell environment (not even the
> default value).
You get the default values.
--
``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/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, 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 <=
- Re: feature-request: don't count history time comment lines when in HISTFILESIZE, Christoph Anton Mitterer, 2015/03/26