Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: In response to the maximum size of $HISTSIZE



» On Mon, Apr 10, 2006 at 04:10PM +0200, Nikolai Weibull wrote:

> Why not make it possible to have a time-based history-scheme instead
> of a static size-based one?  What I mean is that since Zsh allows
> history items to be timestamped, add another parameter $HISTAGE and
> keep items "younger" than that value.  It could be given in days,
> weeks, months and/or years, I suppose.

What happens with mistakes setting date? What happens when you go on
vacantion? Abandon the account for a while?

I would rather have the shell appending all entries removed due to
HISTSIZE into some other file.

Anyway what you want to have is to configure logrotate and run it on
cron. logrotate can handle this easily and be tailored to the task,
something like this should work (untested!):

cronjob:
@daily	cat .zhistory >>! .zhistory.log
@daily 	logrotate ~/rotate_hist.rc

# Logrotate UNTESTED conf file

$HOME/.zhistory.log {
           monthly
	   # weekly
           # daily
           rotate 36
	   dateext
	   nomail
	   create
#	   firstaction
#	   # you may remove duplicates here....
#	   endscript
       }
# END of it.

You could then happily grep (or zgrep) on it. Which is not the same as
zsh's history searching power, but how often do you need to retrieve a 2
or 3 year old command?

Cheers,
-- 
Francisco Borges




Messages sorted by: Reverse Date, Date, Thread, Author