From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17645 invoked from network); 27 Jun 1999 10:32:05 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Jun 1999 10:32:05 -0000 Received: (qmail 22996 invoked by alias); 25 Jun 1999 18:12:18 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2411 Received: (qmail 22988 invoked from network); 25 Jun 1999 18:12:16 -0000 From: "Bart Schaefer" Message-Id: <990625181208.ZM5400@candle.brasslantern.com> Date: Fri, 25 Jun 1999 18:12:08 +0000 In-Reply-To: <37728773.4575C980@pdi.com> Comments: In reply to dado "deleting history" (Jun 24, 12:30pm) References: <37728773.4575C980@pdi.com> X-Mailer: Z-Mail (5.0.0 30July97) To: dado , zsh users list Subject: Re: deleting history MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 24, 12:30pm, dado wrote: } Subject: deleting history } } is there a way of deleting entries in the history? Only by deleting all of it. } also, is there a way of preventing commands from being added to the } history? } I'm not talking about preceding them with a blank. Only by deleting all of it. } Let say I'll issue a bunch of different commands, going back to them } in no particular order. When I'm done, I'd like those commands only to } be } erased. Something like } do_not_log_this_commands_for_good_but_just_for_now. The obvious thing would be to start another shell and then exit it when you're done, so I won't ask why not. function toggle-temporary-history() { if (( ${TEMPHIST:-0} > HISTSIZE )) # If alternate then eval "HISTSIZE=0; HISTSIZE=$HISTSIZE" # Flush history SAVEHIST=$TEMPHIST # Resume saving fc -R # Reload saved unset TEMPHIST # Toggle off else TEMPHIST=$SAVEHIST # Toggle on (( SAVEHIST < HISTSIZE )) && SAVEHIST=$HISTSIZE # Remember all fc -W # Save history SAVEHIST=0 # Prevent save fi } The "flush history" step isn't strictly necessary, but in case the file somehow became smaller than HISTSIZE (say, you reset HISTSIZE larger while temporary history was toggled on) this assures that the entire temporary history gets erased. In 3.1.6 (not 3.0.6; both are coming soon) you can even bind the above to a keystroke. Note that the above doesn't work very well if you have two shells sharing the history or another shell incrementally appending to it; in that case you may want to pass a temp file name to the two "fc" commands above. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com