From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: retrieving invocation arguments
Date: Mon, 17 Sep 2001 15:17:30 +0000 [thread overview]
Message-ID: <1010917151730.ZM5670@candle.brasslantern.com> (raw)
In-Reply-To: <19990.1000724834@csr.com>
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
next prev parent reply other threads:[~2001-09-17 15:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-14 20:42 Adam Spiers
2001-09-15 17:34 ` Bart Schaefer
2001-09-17 10:02 ` Sweth Chandramouli
2001-09-17 11:07 ` Peter Stephenson
2001-09-17 15:17 ` Bart Schaefer [this message]
2001-09-17 15:38 ` Peter Stephenson
2001-09-17 16:06 ` Bart Schaefer
2001-09-17 20:59 ` Adam Spiers
2001-09-17 20:25 ` Sweth Chandramouli
2001-09-18 10:53 ` Adam Spiers
2001-09-17 10:23 ` Adam Spiers
2001-09-17 16:13 ` Bart Schaefer
2001-09-18 11:39 ` Adam Spiers
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=1010917151730.ZM5670@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/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).