[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: why does the shell show commands foolishly when I press UP key?



On Fri Nov 16, 2007 at 22:46:22 +0100, Michelle Konzack wrote:

>     while read LINE
>     do
>       if [ -z "$(grep "${LINE}" ~/.bash_history.tmp)" ] ; then
>         echo -e "${LINE}" >>~/.bash_history.tmp
>       fi
>     done

  That is just *nasty*.  For each line in the file you invoke
 a new grep...

  What about :

      sort -u < ~/.bash_history > ~/.bash_history.new

 Sure it re-orders entries, but in practice your current solution does
 too. (ie.  dupes removed between existing commands are going to affect
 the ordering of commands.)

Steve
-- 
Debian GNU/Linux System Administration
http://www.debian-administration.org/



Reply to: