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

Re: RFC: expand $'' within heredocs



On 9/28/22, Eric Cook <llua@xxxxxxx> wrote:
> Hey all,
>
> bash 5.2[1] recently released and a change i found of interest is allowing
> $'' to be expanded
> within heredocs. $'' is currently the only expansion that uses the `$'
> operator that doesn't
> expand within heredocs(even $[] does); so i can see that edgecase being
> confusing in addition
> to the feature just being useful.
> cat <<eof
> hello$'\t'world
> eof
> ...

$'foo' is technically a form of quoting, not expansion, so it is
consistent the way it is now. Eg, there is no $ operator in play, the
$' together form an operator (if you want to call it that) which
begins this particular form of quotes.

% cat << EOF
"foo" 'foo' $'foo'
EOF
"foo" 'foo' $'foo'


-- 
Mikael Magnusson




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