Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: local after setopt allexport?



faith@xxxxxxxxxx wrote:
> Is there a way to keep variables from being exported after setopt
> allexport?

Variables are only exported when set, so you can temporarily unset the
option and set the variable in a shell function to get this effect.
You might need to make `noexport' more sophisticated.

% setopt allexport
% foo=bar 
% printenv foo
bar
% unset foo
% noexport() { setopt localoptions; unsetopt allexport; $1=$2; }
% noexport foo bar
% printenv foo
% print $foo
bar

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



Messages sorted by: Reverse Date, Date, Thread, Author