bug-bash
[Top][All Lists]
Advanced

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

parsing error with heredoc and command substitution


From: Alex Khesin
Subject: parsing error with heredoc and command substitution
Date: Tue, 13 Jul 2010 13:51:31 -0400

Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-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 alexk 2.6.32-gg173-generic #gg173 SMP Wed Jun 23
05:24:15 UTC 2010 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.1
Patch Level: 5
Release Status: release

Description:

The following script used to work in bash 3.2 but does not work with
bash 4.x (I tried 4.0, 4.1.5, and 4.1.7)

------
#!/bin/bash

a=$(/bin/cat << EOF | wc -l
a
b
EOF
)
-----

/tmp/bug.sh: line 3: unexpected EOF while looking for matching `)'
/tmp/bug.sh: line 8: syntax error: unexpected end of file

The following works correctly (changed /bin/cat to cat):

------
#!/bin/bash

a=$(cat << EOF | wc -l
a
b
EOF
)
-----

and so does this (removed | wc -l):

------
#!/bin/bash

a=$(/bin/cat << EOF
a
b
EOF
)
-----



reply via email to

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