bug-bash
[Top][All Lists]
Advanced

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

Re: Problem outputting a quote in a variable expansion which is in a her


From: Chet Ramey
Subject: Re: Problem outputting a quote in a variable expansion which is in a here doc
Date: Wed, 7 Dec 2016 13:04:55 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.5.0

On 12/6/16 7:56 PM, Daniel Einspanjer wrote:

> Bash Version: 4.4
> Patch Level: 5
> Release Status: release
> 
> Description:
>     Tested on OSX as well as Ubuntu GNU/Linux 14.4 and Debian Jessie 8
>     Tested with Bash 4.3 and 4.4
> 
>     When trying to output a string from a variable expansion that is inside
> a here doc, the quotes don't behave the same as when not in a here doc.

Here-document lines are processed differently: they are expanded as if
within double quotes, though double quotes in the expanded lines are not
treated specially.  This leads to the situation where the backslashes
preceding double quotes are preserved.  There is variance in shell
behavior in this area: bash, dash, the FreeBSD sh, mksh, and ksh93 all
expand the lines somewhat differently.

Chet

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



reply via email to

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