From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26506 invoked from network); 12 Jan 1998 11:02:43 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 12 Jan 1998 11:02:43 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id FAA15116; Mon, 12 Jan 1998 05:45:05 -0500 (EST) Resent-Date: Mon, 12 Jan 1998 05:43:43 -0500 (EST) From: Andrew Main Message-Id: <199801121045.KAA05850@taos.demon.co.uk> Subject: Re: Exporting arrays To: adam.spiers@new.ox.ac.uk Date: Mon, 12 Jan 1998 10:45:06 +0000 (GMT) Cc: zsh-users@math.gatech.edu In-Reply-To: <19980111181603.60292@thelonious.new.ox.ac.uk> from "Adam Spiers" at Jan 11, 98 06:16:03 pm X-Loop: zefram@tao.co.uk X-Headers: in preparation X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"GpLq52.0.eh3.UFVkq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1219 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Adam Spiers wrote: >% foo=(a b c) >% typeset | grep zzz >array foo=(a b c) >% export foo=(a b c) >% typeset | grep zzz >array exported foo=(a b c) > >However, > >% unset foo >% export foo=(a b c) >% typeset | grep zzz >exported foo='(a b c)' This sort of thing has cropped up before, and it has always been due to human error. In the case of "export foo=(a b c)", the parens do not actually delimit an array. They are treated as globbing metacharacters. This command runs the builtin "export", with argument "foo=(a b c)", which it interprets as a request to export the variable "foo" and set its value to the scalar "(a b c)". In the second of your dialogues, that's precisely what happens. In the first dialogue, you first set foo to be an array, and the export command refused to change it to a scalar. 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