[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: String Concatenation with $'\NNN' Error
From: |
Greg Wooledge |
Subject: |
Re: String Concatenation with $'\NNN' Error |
Date: |
Mon, 16 Mar 2009 08:17:51 -0400 |
User-agent: |
Mutt/1.4.2.2i |
On Sun, Mar 15, 2009 at 07:21:06AM -0000, tony@accesslab.com wrote:
> This command sequence concatenates a text string with a $'\NNN' string
> producing an error:
> shopt -s extglob; x="hello"$'\179'; echo "${x//+([^[:print:]])/?}"
>
> EXPECTED RESULT IS -> hello?
>
> HOWEVER, THE RESULT THAT IS PRODUCED IS -> hello?9
'179' is not a valid octal number. What you're actually doing is putting
hello$'\017'9 into the variable, which you can verify by dumping the
contents of $x before the substitution.