zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: '<<-' here-documents oddity with line continuation
Date: Fri, 9 Feb 2018 08:01:41 +0100	[thread overview]
Message-ID: <3216ee27-0c11-013d-3b32-55c8dc8587c3@inlv.org> (raw)
In-Reply-To: <c552e444-92c4-5035-271b-4c38cc27bbeb@inlv.org>

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.


  reply	other threads:[~2018-02-09  7:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03 17:39 Martijn Dekker
2018-02-09  7:01 ` Martijn Dekker [this message]
2018-02-09  7:58   ` Martijn Dekker
2018-02-09  9:24   ` Peter Stephenson
2018-02-09 15:27     ` Stephane Chazelas
2018-02-09 16:07       ` Martijn Dekker
2018-02-09 18:19         ` Martijn Dekker
2018-02-12 10:07           ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3216ee27-0c11-013d-3b32-55c8dc8587c3@inlv.org \
    --to=martijn@inlv.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).