From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5711 invoked from network); 17 Sep 2001 15:19:25 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Sep 2001 15:19:25 -0000 Received: (qmail 24497 invoked by alias); 17 Sep 2001 15:19:03 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4230 Received: (qmail 24482 invoked from network); 17 Sep 2001 15:19:01 -0000 From: Bart Schaefer Message-Id: <1010917151730.ZM5670@candle.brasslantern.com> Date: Mon, 17 Sep 2001 15:17:30 +0000 In-Reply-To: <19990.1000724834@csr.com> Comments: In reply to Peter Stephenson "Re: retrieving invocation arguments" (Sep 17, 12:07pm) References: <19990.1000724834@csr.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: retrieving invocation arguments MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 17, 12:07pm, Peter Stephenson wrote: } Subject: Re: retrieving invocation arguments } } Or use the $options array from zsh/parameter. Here's a function that saves } your options to a file; you just source that file to restore the options. } (The for-loop uses new 4.1 syntax, it's not too hard to make it } backward-compatible.) It's also not hard to do away with it entirely! ## begin saveopts emulate -L zsh # This takes care of ksharrays et al. # I'm not sure what PWS was doing with zmodload -e ... zmodload -i zsh/parameter || return $? if [[ $# != 1 ]]; then print "Usage: saveopts save_file" >&2 return 1 fi local x='(interactive|shinstdin|stdin)' { print -r setopt ${(pj. \\\n .)${(ok)options[(R)on]:#$~x}} print -r unsetopt ${(pj. \\\n .)${(ok)options[(R)off]:#$~x}} } > $1 ## end saveopts Of course none of this answers the original question, because by the time the user gets to execute any shell code the options may have been changed by /etc/zshenv. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net