[Top][All Lists]

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

Re: Unclosed quotes on heredoc mode

From: Lawrence Velázquez
Subject: Re: Unclosed quotes on heredoc mode
Date: Wed, 17 Nov 2021 10:34:33 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-1371-g2296cc3491-fm-20211109.003-g2296cc34

On Wed, Nov 17, 2021, at 7:35 AM, João Almeida Santos wrote:
> I’m a programming student currently on 42 School in Lisbon, and one of 
> our projects is to create a minishell, and to mimic the behavior of 
> bash.


> While testing the heredoc mode, I realized that the $ is not 
> interpreted as variable expansion. That’s interesting.

Are you talking about your project or bash?  In the latter (and
related shells), expansion is only suppressed in a here-document
if, when the delimiter is specified, it is at least partially quoted.

    $ cat <<EOF
    + this is bash $BASH_VERSION
    + EOF
    this is bash 5.1.8(1)-release
    $ cat <<\EOF
    + this is bash $BASH_VERSION
    + EOF
    this is bash $BASH_VERSION

> But the reason why I’m emailing you is that I whenever I tried to use 
> an unclosed quote on heredoc, it doesn’t seem to handle well…it never 
> finishes the heredoc.
> I tried \n for paragraph, verbatim inserting enter, closing quotes on 
> the next line, …don’t know what else to test.

This description is a bit hard to follow.  Could you provide a small
bit of code that demonstrates the issue?


reply via email to

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