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

Re: Export, arrays, and ksh emulation



Bart Schaefer wrote:
> 
> Zsh does not export arrays.  It marks them exported, but does not actually
> put anything into the environment.
> 
> Ksh exports arrays by putting the first array element in the environment,
> the same way that $array == ${array[0]} (as in zsh with ksh_arrays set).
> 
> Should zsh export the first element of an array, either when ksh_arrays is
> set or just under ksh emulation, or in some other condition (new option)?

Well the documentation for KSH_ARRAYS says 'emulate ksh array handling
as closely as possible' and its effect is not limited to numbering
elements from zero so I'd say that zsh should export the first element
of an array when ksh_arrays is set.

Wouldn't it maybe be useful to make zsh do something when an array is
marked as exported. Exporting the whole array separated by spaces might
be more useful than the ksh functionality though it would be better if
it was exported in a way that another zsh could reconstruct it. Maybe
exporting lots of variables with square brackets aroung the index (e.g.
a[1]=...) could work.

Oliver



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