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

Re: local after setopt allexport?

schaefer@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> I confess to be curious why:
> 	setopt allexport
> 	typeset +x FOO=bar
> results in FOO being exported, whereas
> 	setopt allexport
> 	FOO=bar
> 	typeset +x FOO
> results in FOO being local.  Does ksh really ignore the `+x' in the
> first example?  (I should get pdksh so I can stop asking this stuff,
> but then again, most of the time I don't *want* pdksh.)

It looks like ksh makes FOO local in both cases --- in fact, even
without the +x in the first case.  This is just one of many
inconsistencies with typeset which needs a much clearer logic.
Another is that typeset with an existing sufficiently local variable
reports the value, which is confusing in functions.  If I had a list
of all the things it should and shouldn't do I might attempt to
rewrite it one day.

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