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

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



On Thu, 2016-03-03 at 15:34 -0800, Bart Schaefer wrote:
> On Mar 3,  3:16pm, Ryan Wilson wrote:
> } Subject: [bug] () { echo $#} $'' is zero
> }
> } Subject says it all. The empty string $'' is not passed to commands the same
> } way the empty strings "" and '' are:
> 
> $'...' is not a quoted expression, it's a substitution (at least as far
> as zsh is concerned).  It behaves like expanding a $parameter reference,
> except that the value is the string inside the '...' part.
> 
> Thus
>     set -- $''
> is more akin to
>     x=''
>     set -- $x
> than to
>     set -- ''

Well not really.
        % echo $param $'<\n>'
        value <
        >
        % echo "$param $'<\n>'"
        value $'<\n>'

It behaves like $parameter, but definitely not within double
quotes... ;-)

Phil.



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