Re: bash history customizing

From: Gabkin (gabriell_at_programmer.net)
Date: 05/28/04


Date: Fri, 28 May 2004 14:12:10 +0200

On Fri, 28 May 2004 11:22:16 +0200, Thorsten Kampe
<thorsten@thorstenkampe.de> wrote:

>* Gabkin (2004-05-28 08:55 +0100)
>> I also want to eliminate all duplicate commands in my history file,
>> but I want to keep the most recent duplicate only.
>> In other words if my history contains this...
>>
>> 1 cd $HOME
>> 2 vi somefile.txt
>> 3 cp somefile anotherfile
>> 4 exit
>> 5 cd $HOME
>> 6 vi somefile
>> 7 exit
>>
>> I would like it to become
>>
>> 1 cp somefile anotherfile
>> 2 cd $HOME
>> 3 vi somefile
>> 4 exit
>>
>> This way, over time most of my useful, regularly used commands would
>> rise to the top, while the useless ones would sift to the bottom of
>> the list. (for eventual manual purging?)
>>
>> The obvious way is via a sort -u, but this sorts alphabetically which
>> is totally not what I want.

>uniq or zsh

uniq cant do anything that a sort -u cant do, unless there is some
kind of uniq option to get rid of duplicates but keep the _last_
duplicate, not the first.
Also, I dont want to sort the history alphabetically, Im trying to
sort it by common usage.

As for zsh, I'm a bash man! (but does zsh have an evolutionary history
facility like this?)



Relevant Pages

  • bash history customizing
    ... I really like my bash history facility, so much so that i have about ... I would like to prevent invalid commands from being ... cp somefile anotherfile ...
    (comp.unix.misc)
  • bash history customizing
    ... I really like my bash history facility, so much so that i have about ... I would like to prevent invalid commands from being ... cp somefile anotherfile ...
    (comp.unix.shell)
  • Re: Your Professional Advice Please - Design
    ... It really depends what you mean by history. ... I use duplicate table and audit triggers to capture any update/insert/delete ...
    (comp.databases.ms-sqlserver)
  • Re: claiming honors
    ... It obviously goes back to the days when bridge was primarily a gambling ... in Picquet the equivalent of honour bonuses ... It is certainly not Duplicate, ... Sometimes I think we know more about the history of the Roman Empire ...
    (rec.games.bridge)
  • Re: Inquiry: Emulating "Gattaca Look" in PS?
    ... > I've always wanted to be able to save History for just this reason; ... > undo, but to be able to duplicate what I've done. ...
    (comp.graphics.apps.photoshop)