Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
ragupoOffline
15 Post subject: [solved]bash history  PostPosted: 17.03.2011, 22:09



Joined: 2010-09-11
Posts: 29
Location: Copenhagen
Status: Offline
bash history is realy usefull, but reading the settings file .bashrc, i see these lines
      Code:
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth

This gives me the impression that bash shouldn't duplicate lines in history, so when I browse through the history (with the up arrow) the command "apt-get update" should not show up as every third or so saved command. But it does...
I'd really like bash not to duplicate history, can anyone help out here?


Last edited by ragupo on 18.03.2011, 19:29; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
muchan
Post subject: RE: bash history  PostPosted: 18.03.2011, 00:09
Moderator


Joined: 2010-09-11
Posts: 468

from "man bash" (then searching "ignoreboth")
      Quote:

HISTCONTROL
A colon-separated list of values controlling how commands are
saved on the history list. If the list of values includes
ignorespace, lines which begin with a space character are not
saved in the history list. A value of ignoredups causes lines
matching the previous history entry to not be saved. A value of
ignoreboth is shorthand for ignorespace and ignoredups. A value
of erasedups causes all previous lines matching the current line
to be removed from the history list before that line is saved.
Any value not in the above list is ignored. If HISTCONTROL is
unset, or does not include a valid value, all lines read by the
shell parser are saved on the history list, subject to the value
of HISTIGNORE. The second and subsequent lines of a multi-line
compound command are not tested, and are added to the history
regardless of the value of HISTCONTROL.


From this, I think what you want is not "ignoreboth" or "ignoredups" but "erasedups".
 
 View user's profile Send private message  
Reply with quote Back to top
ragupoOffline
Post subject: RE: bash history  PostPosted: 18.03.2011, 18:37



Joined: 2010-09-11
Posts: 29
Location: Copenhagen
Status: Offline
Thanks muchan
its a long man page and i missed that one. But now i found out how to search man pages too.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by Zafenio