[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `declare -fp` mishandles heredoc with || statement
From: |
Mike Frysinger |
Subject: |
Re: `declare -fp` mishandles heredoc with || statement |
Date: |
Sat, 1 Jun 2013 22:08:54 -0400 |
User-agent: |
KMail/1.13.7 (Linux/3.8.3; KDE/4.6.5; x86_64; ; ) |
On Saturday 01 June 2013 17:07:33 Chet Ramey wrote:
> On 5/31/13 10:37 PM, Mike Frysinger wrote:
> > simple code snippet:
> > $ cat test.sh
> > func() {
> > cat > / <<EOF || echo FAIL
> > 11
> > EOF
> > }
> > declare -fp
> >
> > when run, we see the || statement is incorrectly moved to after the
> > heredoc: $ bash ./test.sh
> > func ()
> > {
> > cat > / <<EOF
> > 11
> > EOF
> > || echo FAIL
> > }
> >
> > every version of bash i tried fails this way (2.05b through 4.2.45)
>
> I don't get this. I see, when using bash-4.2.45:
>
> $ ./bash-4.2-patched/bash ./x1
> func ()
> {
> cat > /tmp/xxx <<EOF ||
> 11
> EOF
> echo FAIL
> }
>
> I get the same thing going all the way back to bash-4.0. I see the same
> results you do on bash-3.2.51, but that's old enough that it's not going
> to change.
err, yeah, sorry. running too many versions of bash (like 10) made me miss
the subtle nuance of the || being up top vs down below. bash-4.0+ work.
-mike
signature.asc
Description: This is a digitally signed message part.