bug-bash
[Top][All Lists]
Advanced

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

backslash<newline> at end of input causes eval parse error


From: jim . avera
Subject: backslash<newline> at end of input causes eval parse error
Date: Mon, 25 Aug 2014 15:06:54 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux lxjima 3.11.0-26-generic #45-Ubuntu SMP Tue Jul 15 04:02:06 
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 0
Release Status: release

Description:

A \<newline> is supposed to be ignored, but if it occurs at the very end of the
input then it causes a prior eval containing an array assignment to be 
mis-parsed.
However if the eval contains something other than an array assignment then no 
error occurs.

Repeat-By:

#!/bin/bash

PATH=/path/to/bash-4.3:$PATH; export PATH
type bash

# This one fails with the following error:
#   bash: eval: line 1: syntax error near unexpected token `foo'
#
echo "*** eval containing array assignment; backslash-newline (FAILS)"
bash -ex <<'EOF'
eval "array=(foo bar)" ; echo AAA\
EOF

# But these work fine...
#
echo "*** eval containing something else; backslash-newline (works)"
bash -ex <<'EOF'
eval "scalar='(foo bar)'" ; echo AAA\
EOF

echo "*** eval containing array assignment; backslash-newline; text (works)"
bash -ex <<'EOF'
eval "array=(foo bar)" ; echo AAA\
BBB
EOF




reply via email to

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