Terminal logout script
Hello puppy users
I like to mess around on the command line however I find my history becomes very messy. Full of duplicates entries
I have export HISTCONTROL=ignorespace:erasedups set in .bashrc however I still end up with duplicates when I exit as bash appends the history in memory to the .history file.
So I found a tip about fixing this with a bash_logout file
To make this work on an interactive shell I added this to .bashrc to trap EXIT
Code: Select all
trap_exit(){
. "$HOME/.bash_logout"
}
trap trap_exit EXIT
MY current .bash_logout file
Code: Select all
history -a && history -c && awk '!a[$0]++' .history > .hist && cp .hist .history
The original used sort -u -o file file instead of awk but I didn't want it to sort it.
My question is what have other done with there .history file? Maybe keeping a set of command in there all the time??