On 2/22/25 12:38 AM, Phi Debian wrote:
The new semantic is simple - numbered are indexed args access (easy to understand) - unumbered are counting only the unumbered from the fmt stringThis way when you don't mix then the both work as expected.
This isn't unreasonable. coreutils git chose the same interpretation. Too bad FreeBSD went the other way.
Now the dare devil can still mix'n'match, it may not produce what they would like, but at least it don't crash, and produce result as announced for this semantic.
No one should mix numbered and unnumbered conversions unless they control everything -- the shell, the shell version, the format string, and all the arguments.
Again the rule I used for ksh93 is that the next arg for fmt reuse is max( number_of_unumbered_occurences, highest_numberd_index )
So you make numbered conversion specifiers relative to some max base from the previous scan through the format string, initializing that base to 0. I had the same idea. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature