bug-bash
[Top][All Lists]
Advanced

[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: Christoph Anton Mitterer
Subject: Re: feature-request: don't count history time comment lines when in HISTFILESIZE
Date: Fri, 27 Mar 2015 01:35:59 +0100

On Thu, 2015-03-26 at 16:54 -0400, Chet Ramey wrote: 
> The solution cannot be bash-specific; the history library is used by many
> other applications.
One, design-wise ugly, idea:
Couldn't you abuse the history comment char another time for that?
Like consider anything between a ^#[[:digit:]] to be part of one
command:

With HISTTIMEFORMAT set that could look like:
#1427416260
echo foo
#1427416363
if true; then
echo bar
fi
#1427416625
./and_so_on


If HISTTIMEFORMAT is not set, you could simply write 0
#0
echo foo
#0
if true; then
echo bar
fi
#0
./and_so_on


AFAICS, this wouldn't break compatibility
- anything that matches ^#[[:digit:]] is already now not stored in the
  history files, AFAICS
- of course one would probably need to clear the history when one
  enables the shopt for using the above schema (or otherwise one could
  see extremely big multiline commands)
  Or one may just start with that way of parsing the file, the first
  time a ^#[[:digit:]] is encountered, and anything before is considered
  to be single commands per line.


Cheers,
Chris.




reply via email to

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