bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `declare -fp` mishandles heredoc with || statement


From: Chris F.A. Johnson
Subject: Re: `declare -fp` mishandles heredoc with || statement
Date: Fri, 31 May 2013 23:27:06 -0400 (EDT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Fri, 31 May 2013, 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)

   With 4.2.37:

func () { cat > / <<EOF || 11
EOF
 echo FAIL
}

--
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]