From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12878 invoked from network); 9 Feb 2001 03:10:25 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Feb 2001 03:10:25 -0000 Received: (qmail 3816 invoked by alias); 9 Feb 2001 03:10:06 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3612 Received: (qmail 3805 invoked from network); 9 Feb 2001 03:10:04 -0000 From: "Bart Schaefer" Message-Id: <1010209030935.ZM15519@candle.brasslantern.com> Date: Fri, 9 Feb 2001 03:09:35 +0000 In-Reply-To: <200102090123.MAA55479@bruce.csse.monash.edu.au> Comments: In reply to Deborah Ariel Pickett "Word splitting in zsh" (Feb 9, 12:23pm) References: <200102090123.MAA55479@bruce.csse.monash.edu.au> X-Mailer: Z-Mail (5.0.0 30July97) To: Deborah Ariel Pickett , zsh-users@sunsite.dk Subject: Re: Word splitting in zsh MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 9, 12:23pm, Deborah Ariel Pickett wrote: } } I've come across this little problem in zsh when I run it under } setopt SHWORDSPLIT (not that this is something I normally do). There's definitely some kind of bug here. zagzig% echo $ZSH_VERSION 3.0.8 zagzig% set "a1 a2 a3" b c zagzig% print -l ${1+"$@"} a1 a2 a3 b c zagzig% setopt shwordsplit zagzig% print -l ${1+"$@"} a1 a2 a3 b c zagzig% Well, that's not quite right, but 3.1.9-dev-8 is even worse: zagzig% echo $ZSH_VERSION 3.1.9-dev-8 zagzig% set "a1 a2 a3" b c zagzig% print -l ${1+"$@"} a1 a2 a3 b c <-- Yipes! zagzig% setopt shwordsplit zagzig% print -l ${1+"$@"} a1 a2 a3 b c zagzig% It wasn't always so: zagzig% echo $VERSION zsh 2.4.306 beta zagzig% setopt shwordsplit zagzig% set "a1 a2 a3" b c zagzig% print -l ${1+"$@"} a1 a2 a3 b c zagzig% I don't know exactly when this bug was introduced, though. } bruce ~ % args "$@" } # Acceptable, but Bourne sh would print a single blank entry here, since } # there's a pair of quotes. Actually, that's not quite true. Some versions of Bourne sh expand "$@" to the empty string, and some expand it to no string at all. The reason for the ${1+"$@"} hack in many shell scripts is so that you don't have to care which flavor of Bourne shell you have. Zsh has always tried to be in the latter camp, e.g., zagzig% print -l X "" X X X zagzig% print -l X "$@" X X X zagzig% -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net