Greg Wooledge <g...@wooledge.org> writes:
>> You need to escape one of the types of quotes. Double quotes is
>> generally simpler:
>> 
>> $ x="foo \"foo\" and 'bar' content"
>> $ echo "$x"
>> foo "foo" and 'bar' content
>
> Only in this restricted case.  Using double quotes as the outer layer
> means you have to backslash-escape *lots* of other characters inside
> the payload: double quotes, dollar signs, backticks, and backslashes
> at the very minimum.

My understanding is that the double-quote method is traditional, having
been around for decades.  Though that works uniformly only in scripts,
where history expansion is off by default.  But it's well-known that the
characters you need to quote inside double quotes are *exactly* double
quotes, dollar signs, backticks, and backslashes.

Dale

Reply via email to