bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistent quote and escape handling in substitution part of param


From: Steven W. Orr
Subject: Re: Inconsistent quote and escape handling in substitution part of parameter expansions.
Date: Tue, 28 Feb 2012 12:05:30 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.27) Gecko/20120216 Thunderbird/3.1.19

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.


--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]