Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
shwordsplit: final non-whitespace IFS character problem
- X-seq: zsh-workers 41487
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: shwordsplit: final non-whitespace IFS character problem
- Date: Fri, 4 Aug 2017 04:03:19 +0200
- 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
In field/word splitting, a final non-whitespace IFS delimiter character
is counted as an empty field. This is unlike every other current shell
(including current versions of pdksh, i.e. mksh and OpenBSD ksh).
Test script:
setopt shwordsplit
IFS=:
x=a:b:
set -- $x
echo $#
Expected output: 2
Actual output: 3
The POSIX standard appears pretty ambiguous on this:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
https://osdn.jp/ticket/browse.php?group_id=3863&tid=35283#comment:3863:35283:1435293070
[click on "Show all old Histories" for complete discussion]
However, it turns out that the intention of the standard was clarified
back in 1995 (!) in:
http://www.open-std.org/JTC1/SC22/WG15/docs/rr/9945-2/9945-2-98.html
IOW, the intention of the POSIX standard is for IFS characters to be
field terminators rather than separators (in spite of the S in IFS).
Sorry if the timing of this is awkward (shortly before an upcoming release).
Thanks,
- M.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author