[Top][All Lists]

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

Re: Unexpected history expanded in heredoc in $() or <()

From: Chet Ramey
Subject: Re: Unexpected history expanded in heredoc in $() or <()
Date: Mon, 1 Jun 2020 14:43:27 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.8.1

On 5/29/20 11:59 AM, ladyrick wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> Description:
>       A heredoc starts with "cat <<'EOF'" is expected to not expand anything 
> just like in a single quote string. But when this heredoc is in a $() or <(), 
> history is expanded.

It's an interesting question. While quoted here-document delimiters do
suppress expansion, unquoted delimiters result in expansion similar to
double quotes, and double quotes don't suppress history substitution.
Yet, when not in a command substitution, history substitution is never
performed on the lines in a here-document.

But consistency is important, and I agree that the expansion should not
take place while parsing command or process substitutions, whether or not
the delimiter is quoted.


``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]