bug-bash
[Top][All Lists]
Advanced

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

Re: feature request: configurable history timestamps


From: Alex Shinn
Subject: Re: feature request: configurable history timestamps
Date: Thu, 22 Dec 2011 18:40:03 +0900

On Sun, Dec 18, 2011 at 3:26 AM, Chet Ramey <address@hidden> wrote:
> On 12/11/11 1:13 AM, Alex Shinn wrote:
>
>> I had initially been confused by the HISTTIMEFORMAT
>> variable thinking it could be used to change what was
>> written to the history file, rather than the output of the
>> history command.
>>
>> Obviously it would have to be a separate variable, but
>> the ability to add extra info to the history file would be
>> very useful to me.  Given the pid and pwd you can
>> effectively track sessions, and know where you invoked
>> a command in addition to when.
>>
>> As a simple change, just statically appending the bash
>> pid such that the history file looks like:
>>
>>   #1323582935 217
>>   command
>>
>> would enable constructing a session and inferring the
>> pwd by checking for cd/pushd/popd commands (assuming
>> no other aliases or scripts are used to chdir).
>
> One question is whether or not this would be of general interest, since
> any user-specified text to append to the timestamp would have to come
> after the timestamp and be more-or-less ignored by the history code proper.
> (and the timestamp would have to be inserted unconditionally).  What's the
> use case?  Third-party forensics?  You can already use HISTFILE to break
> out history by session, so this would only be worth it if you insisted on
> using a single history file for all shell sessions.

Yes, I do insist on this - I want ^R and history search
to be able to search all my sessions.

-- 
Alex



reply via email to

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