[Top][All Lists]

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

Re: [Help-bash] Question about escaping in backquote string in double qu

From: Andy Chu
Subject: Re: [Help-bash] Question about escaping in backquote string in double quoted strings
Date: Thu, 2 May 2019 11:52:49 -0700

On Thu, May 2, 2019 at 10:56 AM Greg Wooledge <address@hidden> wrote:

> On Fri, May 03, 2019 at 01:05:47AM +0800, KHMan wrote:
> > echo "[` echo \" \\" \" `]"             # [ " ]      (A)
> > So my question is, what did bash do in (A), which seems to affect the
> > specific case of the double quote char only?
> At this point you either run away screaming, or you just admit that
> everyone was *correct* when they told you that you should use $(...)
> instead of `...` because backslash handling inside `...` is too surprising.

Yeah I would agree to just use $() and get on with life.  It's accepted
everywhere, so you can safely modify existing shell scripts to use $()
instead of `` whenever there's an issue.

I implemented part of the surprising behavior of \" inside `` for OSH
recently, because virtualenv depended on it.  I was not able to come up
with any rule that didn't involve special cases for a specific number of
backslashes.  I ended up implementing something slightly simpler that ran
virtualenv, but that disagrees with existing shells in at least one case.
No I do not care to revisit it :)


reply via email to

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