Problems with the history

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
aalemann

Problems with the history

Post by aalemann »

Hi,

I find the history in the bash quite useful and I wanted to increase its size. Therefore I create a .bashrc file in my home directory (there was no such file in it before), wrote the appropriate commands into it and it worked.
However, when I set the option "erasedups" which should prevent me from getting duplicate entries in my history file, this is not working, "ignoredups" works though.

What am I doing wrong?

Here is my .bashrc:

Code: Select all

echo "   DON'T PANIC   "

alias ll="ls -l"
alias la="ls -a"

# set behaviour of the history
export HISTCONTROL=ignoredups:erasedups
export HISTSIZE=100000
export HISTFILESIZE=100000
shopt -s histappend
PROMPT_COMMAND="history -a"
Yes, I logged out and in after editing/creating my .bashrc.

Thanks,
aalemann
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Habitual

Re: Problems with the history

Post by Habitual »

I've had

Code: Select all

HISTCONTROL=ignoredups:erasedups:ll
in my .bashrc for years,
What I have noticed is that it only ignores 2 identical commands in a row,

YMMV :)

Hope that helps.
Locked

Return to “Scripts & Bash”