[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
$\n doesn't get expanded between double-quotes ['PureMessage.Watchdog':
From: |
fsc-log-rjn |
Subject: |
$\n doesn't get expanded between double-quotes ['PureMessage.Watchdog': checked] |
Date: |
Fri, 3 Jul 2009 04:17:13 +0100 |
Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall
uname output: Linux fsc-log 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17
01:57:59 UTC 2009 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu
Bash Version: 3.2
Patch Level: 48
Release Status: release
Description:
Bash allows escape characters to be embedded by using the $'\n'
syntax. However, unlike all other $variables,
this doesn't work with embedded newlines. I think it should.
Repeat-By:
X="a$'\n'b c"
echo "$X"
expect to see:
a
b c
actually see:
a$'\n'b c
Fix:
$'\n' should be expanded within double-quotes, like other variables
are.
Otherwise, please correct the man-page to make it clearer.
If this is a feature, not a bug, then is there a better way to include
newlines in a variable-assignment?
The syntax X="a"$'\n'"b c" will do it, but that is really really
ugly.
Thanks,
Richard
This e-mail has been sent in confidence to the named
addressee(s). If you are not the intended recipient you
must not disclose or distribute it in any form, and you are
asked to contact the sender immediately
Unipart Group of Companies Ltd. Registered in England No. 1994997
Registered office: Unipart House, Cowley, Oxford, OX4 2PG