Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

shwordsplit: final non-whitespace IFS character problem

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
set -- $x
echo $#

Expected output: 2
Actual output: 3

The POSIX standard appears pretty ambiguous on this:


[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:

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).


- M.

Messages sorted by: Reverse Date, Date, Thread, Author