Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: shwordsplit and ksharrays will change rcexpandparam's behavior on empty array
- X-seq: zsh-users 17265
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: shwordsplit and ksharrays will change rcexpandparam's behavior on empty array
- Date: Thu, 13 Sep 2012 08:05:21 -0700
- In-reply-to: <20120913130550.GA23186@localhost.localdomain>
- 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
- References: <20120913130550.GA23186@localhost.localdomain>
On Sep 13, 9:05pm, Han Pingtian wrote:
}
} % zsh -c 'xx=(); print foo${^xx}bar'
} <empty>
} % 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[*]}.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author