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

Re: '<<-' here-documents oddity with line continuation



Op 03-02-18 om 18:39 schreef Martijn Dekker:
> In a construct like
> 
> 	cat <<-EOF
> <tab>	one \
> <tab>	two
> <tab>	EOF
> 
> where the newline after "one \" is backslash-escaped (line
> continuation), zsh outputs
> 
> one two
> 
> whereas all other shells (bash, dash, *ksh, yash, etc.) output
> one <tab>two
[...]

While figuring out a patch for the above issue, I found another oddity
as well, that more clearly looks like a bug.

zsh:

cat <<EOF
foo\
EOF

output: foo (no final linefeed)

Every other shell:

cat <<EOF
foo\
EOF
EOF

output: fooEOF

The line continuation backslash after 'one\' should make the first EOF
part of the same line as 'one', thereby deactivating it as a terminator.

In the next few days I hope to submit a patch that fixes both issues.

Meanwhile I would welcome opinions whether either or both of these
issues should be fixed unconditionally, or in emulation only -- and, if
the latter, what shell option to attach it to. POSIX_STRINGS maybe?

Thanks,

- M.



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