Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: using 'fc' to backup 'zhistory (was Re: saving history file based on # of commands)
- X-seq: zsh-users 363
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: luomat@xxxxxxxx, zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: using 'fc' to backup 'zhistory (was Re: saving history file based on # of commands)
- Date: Sun, 18 Aug 1996 14:01:39 -0700
- In-reply-to: "Timothy J. Luoma" <luomat@xxxxxxxx> "using 'fc' to backup 'zhistory (was Re: saving history file based on # of commands)" (Aug 15, 11:11pm)
- References: <199608160311.XAA14070@xxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Aug 15, 11:11pm, Timothy J. Luoma wrote:
} Subject: using 'fc' to backup 'zhistory (was Re: saving history file base
}
} Someone suggested that I use 'fc' and precmd to call a function to
} backup my zhistory file.
What's wrong with:
function precmd {
fc -AI $HISTFILE
}
This adds every command to your histfile as you type it, and lops off
everything before the last $SAVEHIST entries. Or is that what you say
takes too long?
} However, I cannot figure out how to do this (I keep ending up with
} a size=0 file).
fc -W and fc -A always truncate to SAVEHIST entries, so if you don't
have SAVEHIST set to something greater than zero, nothing will be
written. Could that be what's happening?
} backup the _last_50 commands I have entered (otherwise it gets very
} slow waiting for the entire history file to be backed up, and once
} I have it, I'd rather just add to it than start all over each 50
} commands).
Try this in 3.0.0:
function precmd {
SAVEHIST=50 fc -AI $HISTFILE # Use -WI if this doesn't seem right
}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author