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

Re: [bug] () { echo $#} $'' is zero

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

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