From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23723 invoked from network); 7 Feb 2003 03:53:45 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 7 Feb 2003 03:53:45 -0000 Received: (qmail 9067 invoked by alias); 7 Feb 2003 03:53:14 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5886 Received: (qmail 9058 invoked from network); 7 Feb 2003 03:53:14 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 7 Feb 2003 03:53:14 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.46.181.248] by sunsite.dk (MessageWall 1.0.8) with SMTP; 7 Feb 2003 3:53:13 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h173rFw24756 for zsh-users@sunsite.dk; Thu, 6 Feb 2003 19:53:15 -0800 From: "Bart Schaefer" Message-Id: <1030207035314.ZM24755@candle.brasslantern.com> Date: Fri, 7 Feb 2003 03:53:14 +0000 In-Reply-To: <20030207000138.GK5418@msi.ld> Comments: In reply to Paul Ackersviller "set -A" (Feb 6, 7:01pm) References: <20030207000138.GK5418@msi.ld> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: set -A MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 6, 7:01pm, Paul Ackersviller wrote: } Subject: set -A } } unset arr } set -A arr "${arr[@]}" first } [ ${#arr[@]} = 2 ] && echo "arr[0]='${arr[0]}' arr[1]='${arr[1]}'" } } Note the null entry on the start of the array. This really has nothing to do with "set -A". If you've unset arr, then arr is not an array, and hence ${arr[@]} is not an array either, and therefore "${arr[@]}" does not behave like an array; rather, it behaves like a string, so putting it in double quotes yields the empty string. } I believe the above should work as in ksh, and consistently with } positional parameters Doesn't follow. $@ cannot be unset, it can only be set to the empty array. This example ... } set -- } set -A arr "$@" first } echo arr now has only ${#arr[@]} element ... really corresponds to: arr=() set -A arr "${arr[@]}" first echo arr now has only ${#arr[@]} element } [...] it'd be nice if it at least worked like ksh in emulation mode. This is a clash with zsh's usage where subscripts on a string yeild substring slices. The substring slice [@] is the entire string, so ${string[@]} == ${string}. We were under the impression that this could not possibly clash with a valid ksh script, because no working ksh script could rely upon subscripting a string. We may have to rethink that.