bug-bash
[Top][All Lists]
Advanced

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

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


From: andreas . luik
Subject: bash variable expansion ${var:+"..."} in here-document removes double quotes
Date: Wed, 7 Dec 2016 13:31:21 +0100 (CET)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2 
-Wno-parentheses -Wno-format-security
uname output: Linux linluik.innovative-navigation.de 2.6.32-573.el6.x86_64 #1 
SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

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.

According to the manual, the "word" after :+ is processed with tilde
expansion, parameter expansion, command substitution, and arithmetic
expansion. None of these should have this effect.

Repeat-By:
$ var=1
$ cat <<EOF
> ${var:+"Hi there"}
> ${var:+'Bye'}
> EOF
Hi there
'Bye'

Expected output:
"Hi there"
'Bye'



reply via email to

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