[Techtalk] duplicate bash history entries

aec brat at magma.ca
Mon Sep 13 18:44:51 EST 2004


On Mon, Sep 13, 2004 at 09:25:55AM -0700, Dennis Wheeler wrote:
 
> 
> According to the man page, it appears it only compares the current
> command to the previous one. So two 'ls' in a row, and only one is
> remembered, but do an 'ls' followed by a 'cd' and another 'ls' and
> you'll have both 'ls' in the history.
> 
> Not a very useful setting if that's true.
> 
> You might have more luck with HISTIGNORE instead
> 
> -- Dennis
> 

My .bash_profile does read my .bashrc so I believe Dennis this is
likely what is happening. 

1. cd
2. ls
3. cd 
4  ls

not what I want really. 

Then I read the man page, and I think the option "erasedups" is what I
want.

" A value of erasedups causes all previous lines matching the
  current line to be removed from the history list before
  that line  is  saved."

So: export HISTCONTROL=erasedups 
placed in you .bashrc will only allow one instance 
of "cd" or "ls" for example. Much tidier, at least for me. 
I just tried it and it seemed to work.

Incidently, "man bash" good grief! thats alot of reading!
-- 
Angelina Carlton


More information about the Techtalk mailing list