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

Re: Bug#255788: $'' does not work after <<<



Bart Schaefer wrote:
> > I guess the print-like behaviour of $'...'  is the only thing we do
> > want, right?
> 
> That's apparently how bash has implemented it.  Strictly speaking, I think 
> zsh had the here-string feature first so we're now modifying the zsh 
> feature to match an extension to it that was made by bash, but it seems 
> like a reasonable extension.

But this bit is about here documents, not here strings...

> > '...' has no special effect, and "..." does $-style and
> > `-style expansions which we don't want.
> 
> Now you're talking about the contents of the here-document, rather than
> the value of the end markers?

... and I was talking about the end marker: it seemed to be the
conclusion of what you were saying that in:

cat <<$foo
...
cat <<$'a\tb'
...
cat <<"$(echo hello)"

the \t in the middle case was exanded, but the $ in the other two
weren't.  I haven't even thought about changing anything to do with the
contents.

> > Hmm, we also need to decide whether this applies to here strings.  My 
> > view would be that they get the full expansion treatment, since they are 
> > essentially a command argument, not a glorified end marker.  But I'm 
> > sure you'll let me know if I'm wrong.
> 
> I agree with you with one caveat - consider this from bash:
> 
> [schaefer]$ string="a word with    spaces in it"
> [schaefer]$ cat <<< $string
> a word with spaces in it
> [schaefer]$ 
> 
> I'd have expected "the full expansion treatment" to mean (in bash) that 
> the value of $bar was word-split on spaces, producing "<<< a" and "word" 
> etc. ... but in the case of a here-string, it gets taken as part of the 
> redirection expression, then split, and then pasted back together again 
> (which is even odder, from bash).  So I'm not sure exactly what parse bash 
> is applying to here-strings.

I don't think that's our problem.  We consistently use singsub() for
cases like this and I can't see why we shouldn't here.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



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