zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: luomat@nerc.com, zsh-users@math.gatech.edu
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	[thread overview]
Message-ID: <960818140140.ZM24453@candle.brasslantern.com> (raw)
In-Reply-To: "Timothy J. Luoma" <luomat@nerc.com> "using 'fc' to backup 'zhistory  (was Re: saving history file based on # of commands)" (Aug 15, 11:11pm)

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"


      reply	other threads:[~1996-08-18 21:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-16  3:11 Timothy J. Luoma
1996-08-18 21:01 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960818140140.ZM24453@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=luomat@nerc.com \
    --cc=schaefer@nbn.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).