bug-bash
[Top][All Lists]
Advanced

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

Re: Default time for unmarked history lines


From: Reuben Thomas
Subject: Re: Default time for unmarked history lines
Date: Fri, 8 Jan 2016 13:17:46 +0000

On 8 January 2016 at 04:21, Eduardo A. Bustamante López <address@hidden> wrote:

I now understand your points.

​Thanks very much for taking a look at this.​
 
    address@hidden ...src/gnu/bash % cat ~/.bash_history
    echo 1
    #1452197044
    echo a; sleep 1
    #1452197045
    echo b; sleep 1

    address@hidden ...src/gnu/bash % ./bash -i <<< "HISTTIMEFORMAT='%Y-%m-%dT%H:%M:%S ' history"
    address@hidden:~/local/src/gnu/bash$ HISTTIMEFORMAT='%Y-%m-%dT%H:%M:%S ' history
        1  1969-12-31T18:00:01 echo 1
        2  2016-01-07T14:04:04 echo a; sleep 1
        3  2016-01-07T14:04:05 echo b; sleep 1
        4  1969-12-31T18:00:01 HISTTIMEFORMAT='%Y-%m-%dT%H:%M:%S ' history

So, it seems that new entries are created with the localtime, unless there's a
history comment followed by a timestamp. I'm not sure what changes are needed
to adjust this, but I guess that is not a simple fix.

​I'm puzzled by this. What do you mean by "unless there's a history comment followed by a timestamp"? The history file you dump ends with a command, not a timestamp. I am guessing that the bash you then invoke does not have HISTTIMEFORMAT set in its environment, so no timestamp is added for the last line.
 
BTW, the timestamp = 0 thing is a bug in readline.

​Aha! Thanks.​

--
​ ​


reply via email to

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