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