bug-bash
[Top][All Lists]
Advanced

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

Re: HISTCONTROL=erasedups


From: Chet Ramey
Subject: Re: HISTCONTROL=erasedups
Date: Wed, 09 May 2007 23:46:29 -0400
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

Thilo Six wrote:
> Hello
> 
> Today i came across this neat feature but unfortunately i have a problem with 
> it.
> 
> ~/.bashrc
> <----------------------------
> export HISTCONTROL=erasedups
> ---------------------------->
> 
> $ history
>     1  history
> 
> $ top
> $ htop
> $ top
> $ htop
> $ history
>     1  top
>     2  htop
>     3  history
> 
> 
> i close this shell and open a new terminal:
> 
> $ history
>     1  top
>     2  htop
>     3  history
> 
> $ top
> $ htop
> 
> i close this shell again and *now* i get:
> 
> $ history
>     1  top
>     2  htop
>     3  top
>     4  htop
>     5  history
> 
> So it seems to me entries already written to ~/.bash_history are not
> "eliminated".
> Is this the supposed behaviour?

The erasedups feature works correctly: it removes matching commands
from the history list, which is kept in memory.  When the shell exits,
by default it appends the current history list to the history file.
If you want to force the history file to be completely rewritten, you
can use `history -w' at shell exit to rewrite it.  There is, unfortunately,
currently no easy way to force the `rewrite-at-exit' behavior.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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