zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Deborah Ariel Pickett <debbiep@mail.csse.monash.edu.au>,
	zsh-users@sunsite.dk
Subject: Re: Word splitting in zsh
Date: Fri, 9 Feb 2001 03:09:35 +0000	[thread overview]
Message-ID: <1010209030935.ZM15519@candle.brasslantern.com> (raw)
In-Reply-To: <200102090123.MAA55479@bruce.csse.monash.edu.au>

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   


  reply	other threads:[~2001-02-09  3:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-09  1:23 Deborah Ariel Pickett
2001-02-09  3:09 ` Bart Schaefer [this message]
2001-02-09  7:34   ` Andrej Borsenkow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010209030935.ZM15519@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=debbiep@mail.csse.monash.edu.au \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).