From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29861 invoked from network); 12 Jan 1998 14:19:33 -0000 Received: from ns2.primenet.com.au (7795@203.24.36.3) by ns1.primenet.com.au with SMTP; 12 Jan 1998 14:19:33 -0000 Received: (qmail 430 invoked from network); 12 Jan 1998 14:19:26 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns2.primenet.com.au with SMTP; 12 Jan 1998 14:19:26 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id IAA00534; Mon, 12 Jan 1998 08:58:46 -0500 (EST) Resent-Date: Mon, 12 Jan 1998 08:57:30 -0500 (EST) Sender: rz2a022@rrz.uni-hamburg.de Message-ID: <34BA1F3D.18EE4BAB@rrz.uni-hamburg.de> Date: Mon, 12 Jan 1998 14:48:45 +0100 From: Bernd Eggink Organization: RRZ Uni Hamburg X-Mailer: Mozilla 4.03 [en] (X11; I; AIX 4.1) MIME-Version: 1.0 To: Andrew Main CC: adam.spiers@new.ox.ac.uk, zsh-users@math.gatech.edu Subject: Re: Exporting arrays References: <199801121045.KAA05850@taos.demon.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"Lf68L1.0.P7.95Ykq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1220 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Andrew Main wrote: [ snip ] > Btw, it's impossible to export an array. Unix environment variables are > only strings. There are ways an array could be encoded as a string, > but some other shells get very unhappy about apparently malformed > environment entries. > > -zefram As a workaround, you could convert the array into a word list, using a suited delimiter: a=(one two three four) export aex=${(j(:))a} Then, in the subshell, convert the list back into an array: a=(${(s(:))aex}) Unfortunately this doesn't work if an array element is empty! Example: a=(one '' three four) export aex=${(j(:))a} # aex=one::three:four # ... a=(${(s(:))aex}) # a=(one three four), $#a == 3 I reported this (IMHO) bug already some weeks ago. Has anybody tried to fix it? I wasn't able yet to localize it in the sources. Bernd -- Bernd Eggink Regionales Rechenzentrum der Uni Hamburg eggink@rrz.uni-hamburg.de http://www.rrz.uni-hamburg.de/eggink/BEggink.html