Vincent Lefevre <vincent-o...@vinc17.net> wrote, on 14 Sep 2016: > > > > 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'"}" > > > > In this case, it seems to me that the single quotes are special, [...] > > I cannot see in Issue 7 how they are supposed to be special here.
The standard is clear that the single quotes are special here, and has been since 1992. This text in 2.6.2 Parameter Expansion has not changed since then: The following four varieties of parameter expansion provide for substring processing. [...] Enclosing the full parameter expansion string in double-quotes shall not cause the following four varieties of pattern characters to be quoted, whereas quoting characters within the braces shall have this effect. > And > > http://austingroupbugs.net/view.php?id=221 > > doesn't seem to change anything. It clarifies that the old "even number" wording does not apply to the substring-processing expansions. > At least, they are *not* special > in dash 0.5.8-2.3 and in BusyBox v1.22.1 sh (ash): > > $ foo=abcdef; echo "${foo#'ab'}" > abcdef > > but the other shells regard them as special: > > $ foo=abcdef; echo "${foo#'ab'}" > cdef > > So, is this also unspecified like double quotes? Or should it > be specified that they are special, in which case, dash / ash > are buggy? Dash conforms to the standard if you execute it as "sh". -- Geoff Clare <g.cl...@opengroup.org> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England