Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh-4.0.1-pre4 : manpath and MANPATH
- X-seq: zsh-workers 14405
- From: Peter Stephenson <pws@xxxxxxx>
- To: Richard Curnow <Richard.Curnow@xxxxxx>, zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: zsh-4.0.1-pre4 : manpath and MANPATH
- Date: Mon, 21 May 2001 10:48:15 +0100
- In-reply-to: Your message of "Mon, 21 May 2001 09:24:21 BST." <20010521092420.A16307@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Richard Curnow wrote:
> OK, next question ... what is a good way to delete all the environment
> variables apart from 'special' ones?
Actually, unsetting special variables should work --- I hope we're getting
there. Anyway...
The simplest way I can think of is to use the parameter module. The
associative array $parameters has keys which are parameter names and values
which are the types, which contains what you want to know. (You can get
that type information for a parameter with ${(t)paramname}, but you have to
use e.g. typeset to generate a a list of parameters to test, so this method
is a bit easier.) Something like:
zmodload -i zsh/parameter
for param in ${(k)parameters}; do
type=${parameters[$param]}
[[ $type != *export* || $type = *special* ]] && continue
unset $param
done
Somebody may be able to think of a faster way.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author