10 Eylül 2021 Cuma tarihinde Robert Elz via austin-group-l at The Open Group <austin-group-l@opengroup.org> yazdı: > > When %n$ was added to those implementations of printf which support it, > it seems to have been added in the simplest way possible - printf simply > picks the identified arg, instead of the "next" one, and the implementation > is more or less finished. Generally the implementations remember the > highest > n in any %n$ and that identifies the number of args to remove before > determining if any remain and the format string should be rescanned. >
Wouldn't it be more useful if, in printf(1), `n' in `%n$' referred to the nth argument in the current set of arguments being processed? For example, the command: printf '%2$s %1$s\n' a b c d would print: b a d c And the command: printf '%3$s %1$s\n' a b c d would print: a c That is, the empty string would be taken for the third argument. -- Oğuz