Eric Blake wrote:
On 06/07/2010 04:47 PM, Matthew Woehlke wrote:
But this does not:
$ echo "`echo \"you don\'t say\"`"
you don\'t say
\' is not special inside ``. If it is not special, then the \ is
preserved on to the nested command. Bash's behavior matches POSIX here.
Right; w.r.t. the ``'s, I didn't expect it was. The confusion was due to
not understanding if the \' is or is not inside a ""'d string in the
command substitution.
I expected:
"you don't say"
Then don't use \'. echo "`echo \"you don't say\"`"
I think you meant:
echo "`echo \\\"you don\'t say\\\"`"
:-)
(The above example indicated the quotes emitted in the output.)
That is, I expected that \" -> " substitution would not happen inside
the ``'s outside of the context of the command substitution, since the
quotes do not need to be escaped in that context to be seen as quotes in
the substitution context.
The quotes NEED to be escaped in the quoted command substitution
context, since behavior is undefined if " quotes are not escaped inside
"``".
Okay, thanks. (Actually your other reply was the most helpful of the two
:-).)
--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
Will your shell have salvation? Only if it's Bourne Again.