On 03/12/2015 23:26, Harald van Dijk wrote: > On 03/12/2015 22:17, Stephane Chazelas wrote: >> 2015-12-03 22:02:14 +0100, Harald van Dijk: >> [....] >>> $ for shell in bash mksh posh zsh; do printf %s: "$shell"; $shell >>> -c 'IFS=,; echo a, | { read v; echo "<$v>"; }'; done >>> bash: >>> mksh: >>> posh: >>> zsh: >>> >>> As far as I can tell, the posh/zsh behaviour is the correct >>> behaviour, but I'm not convinced yet my interpretation is correct. >> [...] >> >> zsh and pdksh (and other descendants of the Forsyth shell) treat it as >> separator (and are not compliant), mksh (derived from pdksh) >> changed it recently. posh (also based on pdksh) still hasn't changed it. > > [...] > I do see your point. Thanks for the clear example, I think I agree with > you, the description of field splitting mentions that delimiters are > used as terminators: > > "The shell shall treat each character of the IFS as a delimiter and > use the delimiters as field terminators to [...]" > > It should not be much of a problem to extend the patch I posted to cover > the rules as you describe them, I will make an attempt at this later. Here it is. Attached is an updated patch that ignores the complete terminator if only a single field remains, otherwise ignores only trailing IFS whitespace. Cheers, Harald van Dijk