bug-bash
[Top][All Lists]
Advanced

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

Re: heredoc seems to parse contents even with the quoted delimiter in sh


From: Chet Ramey
Subject: Re: heredoc seems to parse contents even with the quoted delimiter in shell prompt
Date: Mon, 17 Aug 2020 09:23:36 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 8/16/20 1:34 AM, Hyunho Cho wrote:

> 
> if i use the same script in shell prompt then strange error messages appear
> 
> 
> bash$ cat << "EOF"
> this is a test comment
> $(info $(foo ${bar)))
> EOF
> bash: command substitution: line 798: unexpected EOF while looking for
> matching `}'
> bash: command substitution: line 799: syntax error: unexpected end of file

Thanks for the report. The shell is trying to find the end of the command
to figure out how to store it in the history. When you're parsing a here-
document, you need to leave the newlines in the history instead of maybe
adding a semicolon. That code just needs to be more aware of when it can
not parse due to being in the body of a here-document.

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



reply via email to

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