From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24618 invoked by alias); 11 Jan 2014 23:36:05 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18320 Received: (qmail 1602 invoked from network); 11 Jan 2014 23:35:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) 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 autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140111153552.ZM14759@torch.brasslantern.com> Date: Sat, 11 Jan 2014 15:35:52 -0800 In-reply-to: <52D1C33A.7080803@gmx.com> Comments: In reply to Eric Cook "Trailing whitespace after $'\0' with external commands" (Jan 11, 5:18pm) References: <52D1C33A.7080803@gmx.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Trailing whitespace after $'\0' with external commands MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 11, 5:18pm, Eric Cook wrote: } Subject: Trailing whitespace after $'\0' with external commands } } I've noticed trailing whitespace is ignored when it appears immediately } after $'\0'. i am unsure if this is intended behavior or not. } } % zsh -c "/usr/bin/printf '<%s>' $'\0'' '; echo" } <> This is /usr/bin/printf behavior, not zsh behavior. Has nothing to do with whitespace: % zsh -fc "/usr/bin/printf '<%s>' $'\0''none of this'; echo" <> % zsh -fc "printf '<%s>' $'\0''none of this'; echo" I can only conclude that ksh is not actually retaining the nul byte in the argument list when calling /usr/bin/printf. There's an argument (no pun intended) to be made for this behavior, in that it's impossible for a string passed through the argv mechanism of execve and friends to contain an embedded nul; the string will always end at that byte, so ksh assumes it knows better than you and removes it so that the called program (/usr/bin/printf in this case) can see the "whole" string. Conversely, zsh is just doing *exactly* what you told it to do.