[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] bash-4.2-release-with-unlimited-history-by-crq.diff
From: |
Chet Ramey |
Subject: |
Re: [PATCH] bash-4.2-release-with-unlimited-history-by-crq.diff |
Date: |
Tue, 20 Nov 2012 15:40:44 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 |
On 11/8/12 8:17 PM, cheng renquan wrote:
>> I'd rather see this done (and have adapted your previous code submission to
>> do so) in a separate program that links with the history library and can
>> operate on arbitrary history files outside of bash. There are applications
>> besides bash that use readline, save history, and could benefit.
>
> while the current erasedups logic is implemented in bash, I want this
> also get into bash,
> we may define another control like "erasedupsinfile" if the user set
> that we will erase dups in history file as well
>
> HISTCONTROL=ignorespace:ignoredups:erasedups:erasedupsinfile
>
>
> if we contribute a binary to dedup in history file, we still need the
> logic to call it automatically, depending some similar control
> variable is set
With a separate program, you can call it whenever you want. If you want it
to work on the entire current shell history, write a shell function akin to
this:
deep_dedup()
{
history -w /tmp/history.$$
hist_erasedups -t /tmp/history.$$
history -r /tmp/history.$$
rm -f /tmp/history.$$
}
You can have it called from PROMPT_COMMAND, for example, under whatever
conditions you like.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/