On 8/16/21 10:28 PM, Haojun Bao wrote:

> Bash Version: 5.0
> Patch Level: 3
> Release Status: release
> 
> Description:
> 
> A bug found in parse.y, that will treat reading of COMMAND and
> $(COMMAND) differently, despite the info manual saying that:
> 
>> When the old-style backquote form of substitution is used, backslash
>> retains its literal meaning except when followed by '$', '`', or '\'.
>> The first backquote not preceded by a backslash terminates the command
>> substitution.  When using the '$(COMMAND)' form, all characters between
>> the parentheses make up the command; none are treated specially.
> 
> It seems the NL after \\ will be removed when run as $(COMMAND) in parse.y?
> 
> Repeat-By:
> 
> This command will output $'hello \\\nworld\n':
> 
> cat <<EOF
> hello \\
> world
> EOF
> 
> This command will output $'hello \\world\n' (missing the \n after \\):
> echo "$(
> cat <<EOF
> hello \\
> world
> EOF
> )"

Thanks for the report. This is still a problem in bash-5.1, but has been
fixed in the devel branch for a while.

Chet

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

Reply via email to