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    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to