bug-bash
[Top][All Lists]
Advanced

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

Re: history -r in .bashrc ignores HISTTIMEFORMAT


From: Chet Ramey
Subject: Re: history -r in .bashrc ignores HISTTIMEFORMAT
Date: Sun, 11 Jan 2015 12:31:02 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 1/10/15 12:52 PM, Georges Kesseler wrote:

> Bash Version: 4.2
> Patch Level: 45
> Release Status: release
> 
> Description:
>     "history -r" called inside .bashrc does not respect HISTTIMEFORMAT.
> Reads timestamps in as
>         history entries. Calling "history -r" on a command prompt works as
> expected.
> 
> Repeat-By:
>     Put the following into .profile / .bashrc
>        HISTTIMEFORMAT=""
>            lastfile="$(ls -rt history*)"
>            history -r "$lastfile"
>            HISTFILE=~/history$(date +%Y%m%d-%H%M%S)
> 
>         then start new shell, type some commands, exit
>         start second shell, view history

Try adding an assignment to histchars before the call to `history -r':

histchars='!^#'

The history comment character needs to be initialized before reading
the history file.

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



reply via email to

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