According to Eric Blake on 1/13/2010 6:10 AM: >> by contrast, bash warns but still exits successfully: >> $ printf 'cat<<-x\n foo\n x\n'|bash && echo you lose >> bash: line 3: warning: here-document at line 1 delimited by \ >> end-of-file (wanted `x') >> foo >> x >> you lose > > We should mention this in the autoconf manual, so I'm pushing this. I'm > not (yet) sure whether the warning about unterminated here-doc was > introduced in bash 4.0 or bash 4.1, but I can also confirm that bash 3.2 > is silent whereas bash 4.1 warns (but the warning is longer than 80 > columns, so it is not a nice fit in the manual).
I pushed too soon; this revision makes it more apparent that bash had a zero exit status after an unterminated here-doc: -- Don't work too hard, make some time for fun as well! Eric Blake [email protected]
From 56f5b9bc6a3a4a4dccea38005e211066d1ba96cd Mon Sep 17 00:00:00 2001 From: Eric Blake <[email protected]> Date: Wed, 13 Jan 2010 09:46:35 -0700 Subject: [PATCH] Fix previous example. * doc/autoconf.texi (Here-Documents): Touch up the example to match output to sample command line. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 4 ++++ doc/autoconf.texi | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3fa0c5d..1719deb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-01-13 Eric Blake <[email protected]> + Fix previous example. + * doc/autoconf.texi (Here-Documents): Touch up the example to + match output to sample command line. + Document here-doc pitfall. * doc/autoconf.texi (Here-Documents): Mention problem with <<- operator. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 31550fd..1549f89 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -14698,13 +14698,15 @@ Here-Documents here-documents). @example -$ @kbd{printf 'cat <<-x\n\t1\n\t 2\n\tx\n' | bash && echo oops} +$ @kbd{printf 'cat <<-x\n\t1\n\t 2\n\tx\n' | bash && echo done} 1 2 -$ @kbd{printf 'cat <<-x\n 1\n 2\n x\n' | bash-3.2 && echo oops} +done +$ @kbd{printf 'cat <<-x\n 1\n 2\n x\n' | bash-3.2 && echo done} 1 2 x +done @end example @node File Descriptors -- 1.6.4.2
signature.asc
Description: OpenPGP digital signature
