zsh-users
 help / color / mirror / code / Atom feed
* using 'fc' to backup 'zhistory  (was Re: saving history file based on # of commands)
@ 1996-08-16  3:11 Timothy J. Luoma
  1996-08-18 21:01 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Timothy J. Luoma @ 1996-08-16  3:11 UTC (permalink / raw)
  To: zsh-users



Someone suggested that I use 'fc' and precmd to call a function to  
backup my zhistory file.

However, I cannot figure out how to do this (I keep ending up with  
a size=0 file).

What I want to do:

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).

Thanks

TjL

--------------------------------------------------------------------
Timothy J. Luoma <luomat@nerc.com>       http://www.nerc.com/~luomat
          My USENET feed is slow and not very reliable
NeXT info via email: send message with SUBJECT: send-ascii info
        NeXT Information:  http://www.nerc.com/~luomat/next


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: using 'fc' to backup 'zhistory  (was Re: saving history file based on # of commands)
  1996-08-16  3:11 using 'fc' to backup 'zhistory (was Re: saving history file based on # of commands) Timothy J. Luoma
@ 1996-08-18 21:01 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1996-08-18 21:01 UTC (permalink / raw)
  To: luomat, zsh-users

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"


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-08-18 21:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-16  3:11 using 'fc' to backup 'zhistory (was Re: saving history file based on # of commands) Timothy J. Luoma
1996-08-18 21:01 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).