Todd <To...@invalid.invalid> wrote:
> $ rpm -qa bash
> bash-4.1.2-8.el6.x86_64
4.1.5 and 4.0.28(1) here. The script I posted works for me on both
versions; here's a run-time output:
chris:~$ cat /tmp/l
#!/bin/bash
#
L1="My\x20Screwball\x20Label"
Label="${L1//\\x20/_}"
echo "L1: $L1"
echo "Label: $Label"
chris:~$ /tmp/l
L1: My\x20Screwball\x20Label
Label: My_Screwball_Label
> I use the
> b=$'\134' # backslash
b='\' # Works for me (CD)
I'm still confused why (at least two of) you are seeing problems with
'\' at all. (Mind you, I don't have ready access to bash version 2.x so
I can't validate against that version.)
Put '\' inside single quotes and it will always be '\'. Put it
inside double quotes and it becomes a potential candidate for shell
expansion. Leave it outside any quotes and it will be interpreted as
an escape character. This is clearly documented in the manpage for bash
under the section for QUOTING.
Really puzzled,
Chris