From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13562 invoked by alias); 1 Jan 2012 19:17:43 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16686 Received: (qmail 12084 invoked from network); 1 Jan 2012 19:17:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120101111657.ZM736@torch.brasslantern.com> Date: Sun, 01 Jan 2012 11:16:56 -0800 In-reply-to: <20120101065003.GD2920@solfire> Comments: In reply to meino.cramer@gmx.de "Re: Writing to an indirectly named array..." (Jan 1, 7:50am) References: <20120101060936.GC2920@solfire> <111231224548.ZM3626@torch.brasslantern.com> <20120101065003.GD2920@solfire> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: meino.cramer@gmx.de Subject: Re: Writing to an indirectly named array... Cc: zsh-users@zsh.org MIME-version: 1.0 Content-type: text/plain; charset=us-ascii [Cc zsh-users on private reply, hope that's OK] On Jan 1, 7:50am, meino.cramer@gmx.de wrote: } } > set -A $nameofarray elem1 elem2 ... } } ...is there another way by using the (P)-notation somehow ? Yes, but it still doesn't get you things like array+=(elems) or array[N]=(elems), and it's a little more difficult to get the elements split the way you may want them. : ${(PA)=nameofarray::=elem1 elem2 ...} This says to dereference namaofarray and then assign the result of the ::= operator as an array. The shwordsplit (=) operator applies across the whole assigment so elem1 elem2 ... are split as well. If you don't want that semantics, you can apply an explicit split to the right side, e.g., print file has ${(PA)#nameofarray::=${(f)"$(