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

Re: zsh heredoc crash



On Fri, 9 Sep 2016 18:02:50 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I get:
> 
> torch% cat >> /tmp/try <<EOF
> heredoc> export A="$(tr '\n' ' ' <<BLDARC
> heredoc> content
> heredoc> BLDARC)"
> heredoc> EOF
> zsh: parse error

This is a feature:

   <<[-] word
          The shell input is read up to a line that is the same  as  word,
                                          ^^^^
A "line" that matches a "word" means what it says:

% cat <<"HERE)"
heredoc> First line
heredoc> Second line
heredoc> HERE)
First line
Second line

Everything seeems to be working as documented.  ("HERE)" without the
quotes would not be "a word" in the shell sense.)

However, of course, if you think you can make things better without
breaking anything, feel free (I'm certainly not looking for things
to change here).

pws



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