[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parameter expansion oddity
From: |
Tim Waugh |
Subject: |
Parameter expansion oddity |
Date: |
Fri, 4 Jul 2003 17:00:44 +0100 |
User-agent: |
Mutt/1.4.1i |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-D_GNU_SOURCE -O2 -g -pipe -march=i386 -mcpu=i686
uname output: Linux meme.surrey.redhat.com 2.4.20-13.9 #1 Mon May 12 10:55:37
EDT 2003 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
${VAR:+WORD} may be replaced by the expansion of WORD. But there
seems to be no way of creating double quotes in this expansion, since
both quote removal and escaping behave oddly.
Repeat-By:
Trying to get output: "bar"
FOO=bar cat <<EOF
${FOO:+"$FOO"}
EOF
..produces: bar
FOO=bar cat <<EOF
${FOO:+\"$FOO\"}
EOF
..produces: \"bar\"
FOO=bar cat <<EOF
${FOO:+'"'$FOO'"'}
EOF
..produces: ''bar''
pgpERKholuG9E.pgp
Description: PGP signature
- Parameter expansion oddity,
Tim Waugh <=