[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inconsistent quote and escape handling in substitution part of param
From: |
John Kearney |
Subject: |
Re: Inconsistent quote and escape handling in substitution part of parameter expansions. |
Date: |
Tue, 28 Feb 2012 18:26:32 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120129 Thunderbird/10.0 |
On 02/28/2012 06:05 PM, Steven W. Orr wrote:
> On 2/28/2012 11:54 AM, John Kearney wrote:
>> On 02/28/2012 05:22 PM, Roman Rakus wrote:
>>> On 02/28/2012 05:10 PM, John Kearney wrote:
>>>> wrap it with single quotes and globally replace all single
>>>> quotes in the string with '\''
>>> single quote and slash have special meaning so they have to be
>>> escaped, that's it. \'${var//\'/\\\'}\' it is not quoted, so
>>> it undergoes word splitting. To avoid it quote it in double
>>> quotes, however it changes how slash and single quote is
>>> treated. "'${var//\'/\'}'"
>>>
>>> Wasn't it already discussed on the list?
>>>
>>> RR
>>>
>> It was discussed but not answered in a way that helped.
>>
>>
>> Look consider this test=teststring
>>
>>
>> echo "${test//str/"dddd"}"
>
> This makes no sense.
>
> "${test//str/" is a string. dddd is anudder string "}" is a 3rd
> string
>
> echo "${test//str/\"dddd\"}"
>
> is perfectly legal.
>
>
But that isn't how it behaves.
"${test//str/"dddd"}"
because str is replaced with '"dddd"' as such it is treating the double
quotes as string literals.
however at the same time these literal double quotes escape/quote a
single quote between them.
As such they are treated both as literals and as quotes as such
inconsistently.
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., (continued)
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Dan Douglas, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Dan Douglas, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Chet Ramey, 2012/02/29
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Maarten Billemont, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Steven W. Orr, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions.,
John Kearney <=
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Chet Ramey, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Chet Ramey, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Chet Ramey, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Chet Ramey, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Maarten Billemont, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., Chet Ramey, 2012/02/28
- Re: Inconsistent quote and escape handling in substitution part of parameter expansions., John Kearney, 2012/02/28