zsh-users
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: zsh-users@zsh.org
Cc: Ryan Wilson <ryan@enosys.org>
Subject: Re: [bug] () { echo $#} $'' is zero
Date: Thu, 03 Mar 2016 23:33:21 +0100	[thread overview]
Message-ID: <56D8BBB1.4030608@inlv.org> (raw)
In-Reply-To: <1533e4d3e82.cbf3800a134118.3897690426664036468@enosys.org>

Ryan Wilson schreef op 03-03-16 om 22:16:
> Subject says it all. The empty string $'' is not passed to commands the same
> way the empty strings "" and '' are:
[...]
> Any clue as to what's going on?

Apparently, zsh subjects $'' to empty removal[*] as if it were an
unquoted parameter substitution for an empty variable.

This form of quoting is not standardised yet, but this behaviour is
unlike bash, ksh93, mksh and FreeBSD /bin/sh, so I would agree it's a
bug in zsh.

C-style escape $'quoting' looks likely to be added to the next edition
of the POSIX standard (with FreeBSD /bin/sh recently adding support for
it), so now would be a particularly good time to fix it.

- M.

[*] POSIX: "If the complete expansion appropriate for a word results in
an empty field, that empty field shall be deleted from the list of
fields that form the completely expanded command, unless the original
word contained single-quote or double-quote characters."
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06


  reply	other threads:[~2016-03-03 22:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 21:16 Ryan Wilson
2016-03-03 22:33 ` Martijn Dekker [this message]
2016-03-03 23:34 ` Bart Schaefer
2016-03-04  7:16   ` Philippe Troin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D8BBB1.4030608@inlv.org \
    --to=martijn@inlv.org \
    --cc=ryan@enosys.org \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).