bash HISTCONTROL=erasedups should erase duplicates from history file before saving
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gnu Bash |
New
|
Undecided
|
Unassigned | ||
bash (Ubuntu) |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
Binary package hint: bash
The bash option HISTCONTROL=
Steps to reproduce:
1. Setup ~/.bashrc as follows:
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=
export HISTSIZE=1
export HISTIGNORE="history *:cd *:df *:exit:fg:bg:file *:ll:ls:
export HISTFILESIZE=2
#avoid overwriting history
shopt -s histappend
2. Open Terminal 1 and write "echo hola"
3. Open Terminal 2 and write "echo hola"
4. Exit Terminal 1 and 2
5. Open Terminal 3 and execute "history"
Output is:
1 echo hola
2 echo hola
Expected output is:
1 echo hola
When you have more terminals and larger histories the number of duplicates is far larger, thus defeating the purpose of using 'erasedups'.
Changed in bash: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
Changed in bash: | |
status: | Confirmed → Triaged |
This can be solved by: COMMAND= "history -a;history -r;$PROMPT_COMMAND"
export PROMPT_