[Top][All Lists]

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

Re: how does escaping in "`...`" work?

From: Eric Blake
Subject: Re: how does escaping in "`...`" work?
Date: Mon, 07 Jun 2010 17:23:57 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4

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.

> I expected:
> "you don't say"

Then don't use \'.  echo "`echo \"you don't  say\"`"

> 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

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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