Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Inconsistency with SHWORDSPLIT and leading spaces
- X-seq: zsh-workers 37072
- From: Christian Neukirchen <chneukirchen@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Inconsistency with SHWORDSPLIT and leading spaces
- Date: Fri, 06 Nov 2015 11:54:49 +0100
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hi,
I noticed the following different behavior trying to use zsh as /bin/sh:
juno ~% dash -c 'x=foo; echo x${x:+ $x}'
x foo
juno ~% bash -c 'x=foo; echo x${x:+ $x}'
x foo
juno ~% mksh -c 'x=foo; echo x${x:+ $x}'
x foo
juno ~% ksh -c 'x=foo; echo x${x:+ $x}'
x foo
juno ~% zsh -c 'x=foo; echo x${x:+ $x}'
x foo
juno ~% zsh -c 'emulate -L sh; x=foo; echo x${x:+ $x}'
xfoo
juno ~% zsh -c 'emulate -L ksh; x=foo; echo x${x:+ $x}'
xfoo
juno ~% zsh -c 'setopt shwordsplit; x=foo; echo x${x:+ $x}'
xfoo
zsh 5.1.1 (x86_64-unknown-linux-gnu)
zsh-5.1.1-0-g68405f3
It's not clear to me whether this is *actually* POSIX-nonconformant, but
it's at least surprising compared to the other POSIX-compatible shells.
Thanks,
--
Christian Neukirchen <chneukirchen@xxxxxxxxx> http://chneukirchen.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author