Package: bash
Version: 2.05b-26
Severity: normal
Hi,
while trying to escape single quotes in a string, I discovered the following
behavior:
$ x="a'b'c"; echo "${x//\'/\'}"
a\'b\'c
When I leave off the last escaping backslash, the command line parser thinks
the line isn't complete:
$ x="a'b'c"; echo "${x//\'/'}"
>
Entering '}" there gives:
a'}"
'b'}"
'c
So, trying two quotes instead:
$ x="a'b'c"; echo "${x//\'/''}"
a''b''c
I haven't found a method to substitute a pattern with a single quote (not
using external commands of course).
I get the identical behavior if I do ${param/patt/str} instead of
${param//patt/str} and also with Etch's version of batch (reportbug's
info snippet added below the Sarge version's).
The behavior I *expected* is the following:
$ x="a'b'c"; echo "${x//\'/\'\\\'\'}"
a'\''b'\''c
Greetings,
Mike Dornberger
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.26-wolfden.2
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages bash depends on:
ii base-files 3.1.2 Debian base system miscellaneous f
ii libc6 2.3.2.ds1-22sarge6 GNU C Library: Shared libraries an
ii libncurses5 5.4-4 Shared libraries for terminal hand
ii passwd 1:4.0.3-31sarge9 change and administer password and
-- no debconf information
Package: bash
Version: 3.1dfsg-8
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-amd64
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Versions of packages bash depends on:
ii base-files 4 Debian base system miscellaneous f
ii debianutils 2.17 Miscellaneous utilities specific t
ii libc6 2.3.6.ds1-13etch7 GNU C Library: Shared libraries
ii libncurses5 5.5-5 Shared libraries for terminal hand
bash recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]