On 9/14/16 6:14 AM, Joerg Schilling wrote:
> Chet Ramey <[email protected]> wrote:
> 
>> On 9/10/16 7:27 AM, Joerg Schilling wrote:
>>
>>>> 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?
>>>>
>>>> The following shells output 'ab' (with the single quotes):
>>>> dash, bash --posix, mksh, posh, zsh.
>>>
>>> I cannot repeat this with bash --posix..
>>
> 
> OK, I was tesing with a version from 2009.
> 
> But please explain (character by character) why you create an output that is 
> in 
> conflict with the reference implementation (a patched ksh88).

`Character by character'? Really?

(And obviously the so-called `reference implementation' doesn't reflect
the intent of the standard either, as revealed by the discussion.)

Anyway, bash, in its default mode, treats embedded single- and double-
quoted strings as special, and skips over them according to the "skipping
over enclosed quoted strings" portion of the text in 2.6.2 that's been
there since at least 1992.

In 2010-2011, I changed this -- when in Posix mode -- to not treat single
quotes as special, but to retain the existing treatment of embedded double-
quoted strings.  This is valid even in the presence of issue 221, which
leaves the treatment of double quotes inside a double-quoted parameter
expansion as unspecified.  Bash has never allowed double quotes inside a
parameter expansion to terminate a double-quoted string that begins
outside the expansion, so I wasn't going to start then.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://cnswww.cns.cwru.edu/~chet/

Reply via email to