You are not logged in.
Pages: 1
Hello,
I've taken the option "erasedups" from the Arch Wiki on Bash: https://wiki.archlinux.org/title/Bash#H … tomization
It should remove any duplicate entries in bash history. My current .bashrc looks like this (most of it is default, LANG and HISTCONTROL were added by me.
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '
# https://wiki.archlinux.org/title/Bash#History_customization
export HISTCONTROL="erasedups:ignorespace"
export LANG="en_US.UTF-8"However my .bash_history still looks like this:
sudo pacman -Suy
yay -Suy
sudo pacman -Suy
yay -Suy
sudo pacman -Suy
yay -Suy
WINEPREFIX=~/wine winecfg
cat .bashrc
WINEPREFIX=~/wine winecfg
sudo pacman -Suy
yay -Suy
cat .bashrc
xed .bashrc
sudo pacman -SuyWhy is bash ignoring the erasedups command? I'm using gnome-terminal, but that shouldn't make any difference. New commands are added to bash history, but duplicates never removed.
Offline
You may be misunderstanding what that option does,
Try executing the same command 5 times in a row, then check how many times it is shown in history .
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
You may be misunderstanding what that option does,
https://man.archlinux.org/man/bash.1#HISTCONTROL says:
A value of erasedups causes all previous lines matching the current line to be removed from the history list before that line is saved.
This is what I want: Remove previous identical lines from the history.
Try executing the same command 5 times in a row, then check how many times it is shown in history .
If I don't close the terminal it is show only once in history. If I close the terminal, it will appear once for each try.
xed .bash_history
sudo pacman -Suy
etc-update
sudo etc-update
xed .bash_history
xed .bash_history
xed .bash_historyOffline
This is what I want: Remove previous identical lines from the history.
And that's what you're getting: they are removed from the active process history - but it does not edit the already archived HISTFILE content. Though if you do not have histappend set, this file should get overwritten. What's the output of `shopt | grep histappend`?
Last edited by Trilby (2024-07-04 20:46:36)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Though if you do not have histappend set, this file should get overwritten. What's the output of `shopt | grep histappend`?
histappend seems to be off.
$ shopt | grep histappend
histappend offOffline
Hmm, in that case it does seem to be not working as documented.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1