On 2016-09-09 09:02:11 -0400, Chet Ramey wrote:
> On 9/9/16 7:44 AM, Vincent Lefevre wrote:
> > On 2016-09-05 19:12:54 +0000, Mark Galeck wrote:
> >> The standard says in the section 2.2.3 on Double-Quotes and $ :
> >> "even number of unescaped double-quotes or single-quotes, if any,
> >> shall occur".
> > 
> > Concerning this point, these even number of double-quotes and even
> > number of single-quotes are fulfilled with the example below:
> > 
> >   echo "${foo-'a"b'"}"
> > 
> > But is this valid?
> 
> It's unspecified, so anything goes, as per
> 
> http://austingroupbugs.net/view.php?id=221
> 
> "For parameter expansions other than the four varieties that provide
> for substring processing, within the string of characters from an
> enclosed "${" to the matching '}', the double-quotes within which
> the expansion occurs shall preserve the literal value of all
> characters, with the exception of the characters double-quote,
> backquote, <dollar-sign>, and <backslash>. If any unescaped
> double-quote characters occur within the string, other than in
> embedded command substitutions, the behavior is unspecified."

But this will be only in Issue 8.

http://austingroupbugs.net/view.php?id=221 is about "poor
wording", but I don't see where it the above unspecified
in Issue 7.

And one also has:

    "For the four varieties of parameter expansion that provide for
    substring processing (see [xref to 2.6.2 Parameter Expansion]),
    within the string of characters from an enclosed "${" to the
    matching '}', the double-quotes within which the expansion occurs
    shall have no effect on the handling of any special characters."

There's no unspecified behavior concerning the double quotes.
So, what about the following?

  echo "${foo#'a"b'"}"

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to