bug-bash
[Top][All Lists]
Advanced

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

Re: bash variable expansion ${var:+"..."} in here-document removes doubl


From: Chet Ramey
Subject: Re: bash variable expansion ${var:+"..."} in here-document removes double quotes
Date: Wed, 7 Dec 2016 13:24:52 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.5.0

On 12/7/16 7:31 AM, andreas.luik@innovative-navigation.de wrote:

> Bash Version: 4.4
> Patch Level: 0
> Release Status: release
> 
> Description:
> 
> Bash removes double quotes (but not single quotes) when doing variable
> expansion with ${parameter:+word} (Use Alternate Value), in a here-document.

Yes.  All modern shells (bash, ksh93, ksh88, dash, mksh, zsh) with the
exception of the FreeBSD sh (and presumably the NetBSD/OpenBSD sh), do
the same thing.  It's because the here document body is processed as if
it were within double quotes, but double quotes in the lines are not
treated specially.  It's not the most consistent part of expansion, but
there is consistency across shells.

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://cnswww.cns.cwru.edu/~chet/



reply via email to

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