Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16341

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Unexpected history expanded in heredoc in $() or <()
Date 2020-06-01 14:43 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.936.1591037194.2541.bug-bash@gnu.org> (permalink)
References <tencent_487241FE2E73B9237E6574D052A92DD1DE0A@qq.com> <d814512c-982a-05cf-9148-479ae1f4966d@case.edu>

Show all headers | View raw


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.

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: Unexpected history expanded in heredoc in $() or <() Chet Ramey <chet.ramey@case.edu> - 2020-06-01 14:43 -0400

csiph-web