Mike Frysinger wrote: > 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 > #!/bin/bash > 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 > #!/bin/bash > echo $( > cat <<<"foo" > ) > $ ./test.sh > foo
Problem with the $(...) parser not knowing the difference between << and <<<. The attached patch fixes it. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500 --- parse.y 2009-02-26 17:22:15.000000000 -0500 *************** *** 3395,3400 **** else shell_ungetc (peekc); ! tflags |= LEX_HEREDELIM; ! lex_firstind = -1; continue; } --- 3402,3410 ---- else shell_ungetc (peekc); ! if (peekc != '<') ! { ! tflags |= LEX_HEREDELIM; ! lex_firstind = -1; ! } continue; }