[Top][All Lists]

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

Re: Default time for unmarked history lines

From: Chet Ramey
Subject: Re: Default time for unmarked history lines
Date: Mon, 11 Jan 2016 09:22:17 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 1/7/16 11:33 AM, Reuben Thomas wrote:
> Would it be better to have the default time for unmarked history lines to
> be the epoch rather than the current time?

It is circumstance-dependent.  The default you propose would be appropriate
for your situation: a history file where you started maintaining timestamp
entries part way through.  For a history file without any timestamps, using
the current default and setting the history entry timestamp to the current
time is more appropriate.

Unfortunately, there is no good way to distinguish the two cases.  I
suppose the history library could go back and reset the timestamp on all
prior entries when it enounters a timestamp somewhere other than the
beginning of the history file, but I've never seriously considered doing

> I recently added time recording, via HISTTIMEFORMAT, to my bash history. It
> is odd that now when listing it, all the old lines have the current time
> and date; in particular, it violates the expectation that the history will
> (unless I have done odd things to it) be ordered monotonically.

You probably also have histappend set or didn't use something like
`history -w' to force the entire history file to be written when the shell

It's just difficult to tell the difference between history files with no
timestamps and history files with timestamps for only a subset of the

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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