Am 2007-11-08 23:25:02, schrieb Serena Cantor: > I often use UP key to get commands entered previously. The shell show some > commands again and > again, just because I have used them several times. Can the shell be more > smart? > > I use sarge.
First of all as others already saied: HISTCONTROL=ignoredups ...and then maybe a script like: ----8<------------------------------------------------------------------ #!/bin/bash if [ ! -f ~/.bash_history.lock ] ; then echo -n "Please wait, eleminating dups in the ~/.bash_history... " touch ~/.bash_history.lock if [ -f ~/.bash_history ] ; then touch ~/.bash_history.tmp (cat ~/.bash_history) | while read LINE do if [ -z "$(grep "${LINE}" ~/.bash_history.tmp)" ] ; then echo -e "${LINE}" >>~/.bash_history.tmp fi done mv --force ~/.bash_history.tmp ~/.bash_history fi rm --force ~/.bash_history.lock LINES=$(cat ~/.bash_history |wc --lines) echo "${LINES} lines currently." fi ----8<------------------------------------------------------------------ Thanks, Greetings and nice Day Michelle Konzack Tamay Dogan Network Open Hardware Developer Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ ##################### Debian GNU/Linux Consultant ##################### Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSN LinuxMichi 0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature