[Top][All Lists]

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

bash-4.0 regression with here documents and multiline subshells

From: Mike Frysinger
Subject: bash-4.0 regression with here documents and multiline subshells
Date: Thu, 26 Feb 2009 10:30:52 -0500
User-agent: KMail/1.11.0 (Linux/2.6.28; KDE/4.2.0; x86_64; ; )

the documentation shows that for <<< here documents, the word must be right 
after the operator (although it doesnt really spell it out).  not sure if that 
should be made explicit and to have bash reject it, or to fix up this issue so 
it works again ...

at any rate, this style usage, while seemingly not allowed by the docs, works 
fine with older/current bash:
echo $(cat <<< "foo")

however, when we go multiline, bash-4.0 gets into a parsing loop:
$ cat test.sh
echo $(
        cat <<< "foo"
$ ./test.sh
./test.sh: line 2: unexpected EOF while looking for matching `)'
./test.sh: line 5: syntax error: unexpected end of file

if we go ahead and remove that whitespace after the <<<, then it works fine:
$ cat test.sh
echo $(
        cat <<<"foo"
$ ./test.sh

the trouble is that when people write code, they often try to inject 
whitespace to make it readable.  that means using a space between the <<< 
operator and the string they feed it is common from what i can see.

reply via email to

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