From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16092 invoked by alias); 13 Sep 2012 15:05:57 -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: 17265 Received: (qmail 2273 invoked from network); 13 Sep 2012 15:05:55 -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: <120913080521.ZM21720@torch.brasslantern.com> Date: Thu, 13 Sep 2012 08:05:21 -0700 In-reply-to: <20120913130550.GA23186@localhost.localdomain> Comments: In reply to Han Pingtian "shwordsplit and ksharrays will change rcexpandparam's behavior on empty array" (Sep 13, 9:05pm) References: <20120913130550.GA23186@localhost.localdomain> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: shwordsplit and ksharrays will change rcexpandparam's behavior on empty array MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 13, 9:05pm, Han Pingtian wrote: } } % zsh -c 'xx=(); print foo${^xx}bar' } } % zsh -c 'setopt shwordsplit;xx=(); print foo${^xx}bar' } foobar Hmm ... "shwordsplit" is of course code for doing several expansion- related things in a Bourne-shell-like way, mostly but not exclusively splitting on spaces ... it's consistently applied: % xx=(); print foo${=^xx}bar foobar % You can see that this has to do with the difference between $* and $@ if you make it explicit: % xx=(); print foo${=^xx[@]}bar % xx=(); print foo${=^xx[*]}bar foobar % } % zsh -c 'setopt ksharrays;xx=(); print foo${^xx}bar' } foobar This one, however, is definitely correct. With ksharrays, ${xx} means the same as ${xx[0]}, not ${xx[*]}.