Harald van Dijk wrote, on 03 Sep 2024: > > > ---------------------------------------------------------------------- > > (0006872) geoffclare (manager) - 2024-09-03 08:29 > > https://austingroupbugs.net/view.php?id=1852#c6872 > > ---------------------------------------------------------------------- > > > The standard is clear that the expansion of $@ in that case results in no > > fields, but it says nothing about the surrounding "s. > > > > Actually it does. You need to read the $@ description in 2.5.2 in > > combination with the text in 2.6 that references it: > > <blockquote>The shell shall create multiple fields or no fields from a > > single word only as a result of field splitting, pathname expansion, or the > > following cases:<ol> > > <li>Parameter expansion of the special parameters '@' and '*', as described > > in Section 2.5.2, can create multiple fields or no fields from a single > > word.</li></ol></blockquote> > > When this says "single word" it is referring to the whole word (which > > includes any quotes). > > Let me follow up on the list to clear up potential misunderstandings before > responding on the bug tracker. > > The problem that I see with this interpretation is that there is no wording > to distinguish between "$@" and "[$@]". When there are no positional > arguments, we know "$@" must result in no fields, and we know "[$@]" must > result in one field. But the description of $@ does not address this, it > says when there are no positional arguments, it creates no fields
Okay, I see the problem now. It appears that the lengthy discussion of $@ and $* in 2014 which resulted in bug 888 overlooked the case where $@ is embedded in a word with other parts whose expansion is non-null and there are no positional parameters. The text about joining to the other parts of a word assumes there is at least one positional parameter, and the text covering the no-positional-parameters case only covers embedding when the other parts of the word expand to a quoted null string. I think we're going to need to modify both: the joining text needs to address how the join is done when there are no positional parameters, and the current no-positional-parameters text should not apply when $@ is embedded in a word with other parts whose expansion is non-null. -- Geoff Clare <[email protected]> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
