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