From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28532 invoked by alias); 22 Jun 2015 03:11:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35560 Received: (qmail 9927 invoked from network); 22 Jun 2015 03:11:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 Message-ID: <55877BAD.7080700@inlv.org> Date: Mon, 22 Jun 2015 05:06:21 +0200 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Field splitting: extra empty field with final non-whitespace IFS character Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit % emulate sh % IFS=':' % x='a:b::' % set -- $x % echo $# 4 zsh counts 4 fields instead of 3, like most other shells do. In other words, zsh does not treat the non-whitespace IFS character as a field terminator. POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 "The shell shall treat each character of the IFS as a delimiter and use the delimiters as field TERMINATORS to split the results of parameter expansion and command substitution into fields." (emphasis mine) bash, ash, dash, ksh93 and mksh act according to POSIX. pdksh (which is obsolete) and yash act like zsh. I think this should be changed to match the behaviour specified by POSIX in sh and ksh emulation modes. Thanks, - Martijn