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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/