Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.bash.bug > #16765

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: heredoc seems to parse contents even with the quoted delimiter in shell prompt
Date 2020-08-17 09:23 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.31.1597670624.2469.bug-bash@gnu.org> (permalink)
References <CAMMw470OANxwKOJX_h2M8PDK1W9H+FeGJ2jUtrzLftK81DkHJg@mail.gmail.com> <7ca8e05c-1f48-689f-f0b7-5a474a34485f@case.edu>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: heredoc seems to parse contents even with the quoted delimiter in shell prompt Chet Ramey <chet.ramey@case.edu> - 2020-08-17 09:23 -0400

csiph-web