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: Martin Sebor
Subject: Re: bash 4 parse error on here-document in $()
Date: Thu, 24 Sep 2009 09:26:03 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3

Thank you for setting me straight! I had checked the POSIX spec
before sending the report but missed the part about the delimiter
having to be immediately followed by newline.

Martin

On 09/24/2009 06:39 AM, Chet Ramey wrote:
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






reply via email to

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