On Fri, Mar 23, 2018 at 10:27:20AM +0100, Harald van Dijk wrote: > On 23/03/2018 10:10, Herbert Xu wrote: > >On Fri, Mar 23, 2018 at 09:27:37AM +0100, Harald van Dijk wrote: > >> > >>Also the above. But it breaks a traditional ash extension: > >> > >> unset IFS > >> set -- A1 B2 C3 > >> echo ${@%2 C3} > >> > >>This used to print A1 B, but prints A1 B2 C3 with your patch. > >> > >> echo ${@%2} > >> > >>This used to print A1 B2 C3, but prints A1 B with your patch. > > > >Hmm, it still does on my machine: > > Apologies, I ended up sending the wrong test case. It's when IFS has its > default value that the behaviour is changed. It's when it's unset that it > still works. Right. I think I'll leave this one alone. It worked purely by chance previously because dash incorrectly used the first IFS character even when it's outside of double-quotes, which is why the expansion ${@%2 C3} matches. The second example looks strange, but bash/ksh does something funky too in this case: bash-4.2$ echo ${*%2} A1 B C3 bash-4.2$ We could change dash to match this behaviour as it seems to make a little bit more sense but I'm not too bothered. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html