[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Final backslash<newline> causes array assignment mis-parse in previous e
From: |
jim . avera |
Subject: |
Final backslash<newline> causes array assignment mis-parse in previous eval |
Date: |
Mon, 25 Aug 2014 15:25:35 -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:
NOTE: This repeats (approximately) a bug I sent a few minutes ago, but with
an invalid From: address. Most likely my ISP dropped the message as spam,
but if not, please accept my appoligies for the dup.
\<newline> is supposed to be effectively ignored, but if it appears at
the
end of the script then parse errors sometimes occur with previous
statements.
In particular eval "array=(values...)" is mis-parsed if a subsequent
statement
ends with <backslash><newline> and there is nothing further in the script.
However, no error occurs if the eval contains something other than an array
assignment. Or if something follows the \<newline>.
Repeat-By:
#!/bin/bash
PATH=/home/jima/ptmp/downloads/bash-4.3:$PATH; export PATH ; type bash
# This one shows the problem
# An error occurs:
# 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
- Final backslash<newline> causes array assignment mis-parse in previous eval,
jim . avera <=