Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exporting arrays
- X-seq: zsh-workers 3206
 
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxxxxxx>
 
- To: eggink@xxxxxxxxxxxxxxxxxx (Bernd Eggink)
 
- Subject: Re: exporting arrays
 
- Date: Thu, 5 Jun 1997 02:18:40 -0400 (EDT)
 
- Cc: zsh-workers@xxxxxxxxxxxxxxx
 
- In-reply-to: <3395B9DA.58C1C527@xxxxxxxxxxxxxxxxxx> from Bernd Eggink at "Jun 4, 97 08:54:18 pm"
 
> "ar" shows up in the list, but in the following 'zsh'-invocation it is
> unset. Is this intentional? I didn't find any  restrictions mentioned in
> the manual.
The restriction is in Unix.  The contents of an environment variable is
always a plain null-terminated string on Unix.  It is possible to hack
something as a workaround, but there is no prefect solution as far as I
know.  Neither bash not ksh exports arrays.  More precisely ksh93 does
export arrays but only the first array element gets into the enviromnet
(which is consistent since without subscritps a ksh array behaves like a
variable with the first array element as its value).
Exported functions has similar problems (just try foo='() {' bash to
see what I meen).  Probably that's why ksh93 does not have exported
functions and POSIX does not require it.
The foo()=... encoding to put functions into the environment seems to be
more reasonable and does not have the problem mentioned above.  It was even
included in some early POSIX drafts.  I wonder why doesn't bash use that
method instead of this ambiguous foo='() { ...' encoding.
Zoltan
Messages sorted by:
Reverse Date,
Date,
Thread,
Author