Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: '<<-' here-documents oddity with line continuation
- X-seq: zsh-workers 42352
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: '<<-' here-documents oddity with line continuation
- Date: Fri, 9 Feb 2018 15:27:15 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=LpCWo6DJCCROFNqAHqqpnM5DiIXqUfRMqTnskkmuqcQ=; b=q7AUiwnBrTTXGaQRI5j6+JGycEIP/g/SNu+jpFtzWBbYE9oUrWsjBCAjbq3F5G3rmx dX32GXNiSrir0tDF0aMZOoCewdYMdO9JfB8Xikd7a9XDwOFn412R9V6CDrpIdvYQdERo DN2ykBGcUSQ7asoANgufwjg505y86eCkrVKnbtdJzSb9pjtwvDQ5AEVymkTr68doBXt2 mxRzn/VtwuHWaCTKmoyChGUNbY7xGJ3hHC0czI4j4fuwNISgrfhECrU2jawG2GTWuxUU NLUlxYEy1LMx8nJzudaITcYFW/m1Nhx8zH/9PONSwcIDautMMNL0uULOdVkPYdZeeeUu E3YQ==
- In-reply-to: <20180209092427.6eaeafc7@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Peter Stephenson <p.stephenson@xxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <c552e444-92c4-5035-271b-4c38cc27bbeb@inlv.org> <CGME20180209070228epcas4p120a455bcebc8c9e56e62aab679ba61f2@epcas4p1.samsung.com> <3216ee27-0c11-013d-3b32-55c8dc8587c3@inlv.org> <20180209092427.6eaeafc7@pwslap01u.europe.root.pri>
2018-02-09 09:24:27 +0000, Peter Stephenson:
> On Fri, 9 Feb 2018 08:01:41 +0100
> Martijn Dekker <martijn@xxxxxxxx> wrote:
> > 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 for the patch.
>
> I think the question is whether existing users are more likely to be
> relying on this behaviour, or simply finding it confusing. I'd actaully
> hazard the latter --- line continuation is more useful if it's doing
> something a bit more predictable --- so I'd be inclined just to include
> the patch. But I expect there are arguments the other way.
[...]
I agree it makes sense of treating it as a minor compatibility
bug fix.
Note that there's also:
cat << EOF
foo
E\
OF
which zsh does differently from other shells (and that nobody
would ever do).
About order and token recognition to reply on Martijn's initial
report, note that in:
echo "$(echo 'foo\
bar')"
Or
echo "$(cat << 'EOF'
foo\
bar
EOF
)"
The \<LF> is meant *not* to be treated as a line continuation.
bash fixed a bug recently for that (the latter used to output
"foobar", it's only fixed on the development branch).
So there has to be some level of tokenisation and parsing done
before line continuation is handled. It's not like in C where
it's done as one of the first steps of the pre-processing stage.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author