bug-bash
[Top][All Lists]
Advanced

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

Re: bash 4 parse error on here-document in $()


From: Chet Ramey
Subject: Re: bash 4 parse error on here-document in $()
Date: Thu, 24 Sep 2009 08:39:05 -0400

> Machine Type: i386-redhat-linux-gnu
> 
> Bash Version: 4.0
> Patch Level: 23
> Release Status: release
> 
> Description:
>       Bash 4.0 errors on a here-document enclosed in $(). For example:
>       x=$(cat <<EOF
>       foo
>       bar
>       EOF)
>       Ctrl+D
>       -bash: unexpected EOF while looking for matching `)'
>       -bash: syntax error: unexpected end of file

The shell is allowed to do this.  A here-document is supposed to be
terminated by a line containing the delimiter followed by a newline,
not EOF.

However, the behavior is useful enough that I changed the parser to
support it in bash-4.1.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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