On Thursday 26 February 2009 17:29:18 Chet Ramey wrote:
> 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.

yep, and it fixes against the original large script.  thanks!
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to