Steffen Nurpmeso wrote, on 15 Apr 2025: > > Geoff Clare via austin-group-l at The Open Group wrote in > <Z_5vwwvojBKpOJl7@localhost>: > |Chet Ramey wrote, on 11 Apr 2025: > |> The question is whether shells will agree on *which* empty fields are > |> discarded. > |[...] > |> For everyone who isn't on the bash mailing list, this is the message > |> from kre that Steffen is referring to that explains the bash and NetBSD > |> sh behavior. > |> > |> https://lists.gnu.org/archive/html/bug-bash/2025-03/msg00030.html > | > |Okay, with Chet's clue and kre's detailed description, I now see that > |my expectation of "empty fields may be discarded" leading to exactly > |two conforming behaviours was wrong. I had naïvely assumed that each > |shell would either discard all empty fields or retain all empty fields. > > Disclaimer: i will agree with your conclusion below.
Perhaps you changed your mind by the time you finished the email, because I don't see an agreement with my conclusion. > *But*. No, his description is not right. My take-away from his description was that shells can discard some empty fields and retain others. I didn't actually look too closely at his explanation of the expansion(s). Now that I've looked again, I can see that he made some major mistakes. For example: kre> This output (from your message) shows what is happening kre> | 4,1=:a:/ a ,2=a/a,3=/,4=a kre> Showing that $1 is ":a:/ a " $2 is "a" $3 is "" and $4 is 'a' No, $1 is ":a:". The part after the / is from the unquoted expansion of $1 (with spaces produced by echo). After that he says: kre> There is a space at the end of $1, so ... but there is no space at the end of $1, so any reasoning based on that is bogus. > then he says > > The ':' really has little to do with it, the space is a data > char, it isn't in IFS, so isn't going to be touched by field > splitting Again, there is no space. Given these mistakes, I think we need kre (and Chet because he believed kre's description) to revisit their positions on this. -- Geoff Clare <[email protected]> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
