bug-bash
[Top][All Lists]
Advanced

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

error with ' in command substitution


From: Scott Moser
Subject: error with ' in command substitution
Date: Tue, 30 Oct 2007 09:12:57 -0400 (EDT)

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux brickies 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 
2007 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.2
Patch Level: 13
Release Status: release

Description:
#===== test.sh =====
x=$(cat <<"EOF"
bad' syntax
EOF
)
#=== end test.sh ===

$ bash test.sh test.sh: line 2: unexpected EOF while looking for matching `''
test.sh: line 6: syntax error: unexpected end of file

Above, bash errors on the single ' in "bad'".

The above syntax works in on my version of dash (0.5.3-5ubuntu2) and the
version of busybox ash that I tested (1.1.3).

Using the backtick operator works on my version of bash, and a version 2.05b.0 that I tested. backtick does not work on 3.1.17 (sles 10)

I actually see the same behavior as this version of bash on ksh from AIX
5.3.0.0.  There, ksh works with `` bug fails with $().

So, I'm not 100% certain what the "correct" behavior is, but it
certainly seems like this should work.

Repeat-By:
printf "%s\n%s\n%s\n%s\n" \
   'x=$(cat <<"EOF"' "bad' syntax" 'EOF' ')' > test.sh
bash test.sh

printf "%s\n%s\n%s\n%s\n" \
   'x=`cat <<"EOF"' "bad' syntax" 'EOF' '`' > test.sh





reply via email to

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