Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
SH_WORD_SPLIT, $* and null IFS
- X-seq: zsh-users 15439
- From: Paul Mertz <paul.mertz6@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: SH_WORD_SPLIT, $* and null IFS
- Date: Thu, 30 Sep 2010 16:44:12 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=mLmZ/3jsDlFykFU53XvTAeyruFWG3g+zPLt2b1YLRZg=; b=NFFFeCK6Vf6g5HMgYR02t3gu5HS5Bw+/15yo3PAo0Jr3H5Z89icGvSUcnow0abA8mZ nrnR1b1HyzXXyVBXCyWDQg+LxAHsaLHBYekAXDpREx2u+h1Bim9FT1KLVY66QPEiH54M VC/HYtBSbaL649KczSflWQmouJgMiKqSY6Yfg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=XOLpFmA4R/KixAyjeIE7YnDwEImR1CCsul3qZsiqyf5yIxPtD5vC3rzWTFBBXY1z9d T2xMbnI+tpcnZZkiBs4Hp+ac6PCBgh7zip17rD1KzmCNysx5PcRbvS5rpSv6aPxDbseC d+zt2xw+8AKkit4gX7MVmcnAyGwPe9kQCvouE=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hello Everyone,
I encountered some strange behavior with the SH_WORD_SPLIT option and i was
wondering if someone could give me some insight on the matter.
When SH_WORD_SPLIT is set, Zsh will use the IFS to split words during
variable expansion...
But there is apparently some other side effects as well... One of them is
the handling of the special parameter $* and it's double quoted form "$*".
When SH_WORD_SPLIT is NOT set (the default):
- "$*" expand to a single field, with each parameter separated by the IFS.
- $* will not care about the IFS, and expand all parameters as usual
(individually).
When SH_WORD_SPLIT is set:
- "$*" expand to a single field, with each parameter separated by the IFS
(same as before).
- $ will not care about the IFS... EXCEPT if the IFS is null (set to no
value)... then it will also expands to a single field without delimiters
I really don't understand this last behavior...
SH_WORD_SPLIT is a compatibility feature which is automatically triggered
when zsh is invoked as sh or ksh. This behavior is effectively reproducible
using Dash (so this is probably not a bug), but not ksh, nor Bash (even if
invoked as sh, and using the --posix option).
So... it is some kind of POSIX specificity? Or just a hack? Do you know what
was really intended here?
Thanks
Paul
Messages sorted by:
Reverse Date,
Date,
Thread,
Author