zsh-workers
 help / color / mirror / code / Atom feed
* exporting arrays
@ 1997-06-04 18:54 Bernd Eggink
  1997-06-05  6:18 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Bernd Eggink @ 1997-06-04 18:54 UTC (permalink / raw)
  To: zsh-workers

This message, too, semms to have gone to /dev/null the first time...

Excuse me if this is a stupid question, but why can't arrays be
exported? 

  ar=(x y z)
  export ar
  export
  zsh

"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.


-- 
Bernd Eggink
Regionales Rechenzentrum der Universitaet Hamburg
eggink@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: exporting arrays
  1997-06-04 18:54 exporting arrays Bernd Eggink
@ 1997-06-05  6:18 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1997-06-05  6:18 UTC (permalink / raw)
  To: Bernd Eggink; +Cc: zsh-workers

> "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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-06-05  6:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-04 18:54 exporting arrays Bernd Eggink
1997-06-05  6:18 ` Zoltan Hidvegi

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).