From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22730 invoked from network); 15 Feb 2004 17:04:28 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 Feb 2004 17:04:28 -0000 Received: (qmail 5813 invoked by alias); 15 Feb 2004 17:04:08 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7060 Received: (qmail 5802 invoked from network); 15 Feb 2004 17:04:07 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 15 Feb 2004 17:04:07 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.11.9.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 15 Feb 2004 17:4:7 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i1FH45Z21383 for zsh-users@sunsite.dk; Sun, 15 Feb 2004 09:04:05 -0800 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040215170405.ZM21382@candle.brasslantern.com> Date: Sun, 15 Feb 2004 17:04:05 +0000 In-Reply-To: <200402142012.51392.scowles@earthlink.net> Comments: In reply to "S. Cowles" "Re: help with dereferencing variables" (Feb 14, 8:12pm) References: <200402140959.24015.scowles@earthlink.net> <1040214212400.ZM15293@candle.brasslantern.com> <200402142012.51392.scowles@earthlink.net> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh users Subject: Re: help with dereferencing variables MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 14, 8:12pm, S. Cowles wrote: } } Many thanks; that was the info I was missing. One small aesthetics } preference following up on your suggestion and I'm away (does not } preserve newlines in the array element assignments): } } eval ${key}\=\( ${(P)val} \) This is not equivalent to my suggestion nor to your "method 2". It's a bit closer to your "method 1". In the above formulation, ${(P)val} is expanded _before_ being eval'd. That means that spaces and quotes and other shell syntax in the expansion are re-parsed. Compare: key=tmp val=row row='this is a row that may );( print oops in a subshell' eval ${key}\=\( ${(P)val} \) print "$tmp" eval ${key}'=( ${(P)val} )' print "$tmp"