[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash: bug report Here document and Command substitution
From: |
Chet Ramey |
Subject: |
Re: bash: bug report Here document and Command substitution |
Date: |
Sat, 20 Jan 2001 12:30:33 -0500 |
> The following syntax do not work (parse error).
>
> echo $(cat <<-EOF
> this is a )
> EOF
> )
It's lazy evaluation. Bash doesn't parse the contents of a command
substitution until it's time for the command to be executed. Since
the closing right paren is seen first, before the here document
parse is attempted, a syntax error will occur later.
Parsing commands inside $(...) at the same time the command containing
the $(...) is being parsed is very hard to do with a yacc-based parser.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/