On 12/26/15 6:15 PM, james harvey wrote: > When I turn on timestamps for history, .bash_history records without a > timestamp (and possibly in-memory records without a timestamp - not > sure, haven't tested) inherit the modified timestamp of .bash_history > next time it is read.
No. History entries always have a timestamp. By default, the timestamp is the current time when the entry is added to the history list. If the history file doesn't have timestamps, that means entries from the file get the current time when the file is read. Now, since you have histappend set, this will never change: your history will always be appended to the history file and previous entries will never change (nor acquire a timestamp, obviously). > This obviously causes old commands to have a much newer date. > > I look at HISTTIMEFORMAT as display formatting only, since it writes > to .bash_history with since-epoch time. > > My fix would be to log since-epoch timestamps for each command in > .bash_history, and if someone has default HISTTIMEFORMAT, just not to > show the timestamps. This is what setting HISTTIMEFORMAT to the empty string does. That's how you indicate you want timestamps in the history file, since not everyone wants them. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/