On 10/09/2021 22:14, (Joerg Schilling) wrote:
Harald van Dijk <a...@gigawatt.nl> wrote:

Not correct: ksh93 prints the same as bosh

Indeed, something went wrong with the copying there.

  > and pleasew note that my example is
  > using an integer format instead of a string format.

Irrelevant. You wrote:

   > That is exactly what existing implementations do.

Well, I modified the example to make the result easier to understand, since
the POSIX standard requires an empty string to be printed for a missing
string argument and a 0 for a missing integer argument.

Either the distinction matters or it doesn't. If it matters, then it was important to switch back to talk about what Oğuz wrote. If it doesn't matter, then it should not be a problem that I switched back to talk about what Oğuz wrote. It may be that the distinction doesn't matter. If it helps with understanding, I will answer again based on the integer version.

Oğuz's suggested output, translated to the integer version, would be (please correct me if I am misstating anything here):

  $ printf '%3$d %1$d\n' 1 2 3 4
  0 1
  0 3

You wrote that what Oğuz suggested is what existing implementations do. As your tests have shown, even for the integer version, it is not.

  • Adding %n$ conversi... Robert Elz via austin-group-l at The Open Group
    • Re: Adding %n$... Oğuz via austin-group-l at The Open Group
      • Re: Adding... Joerg Schilling via austin-group-l at The Open Group
        • Re: Ad... Harald van Dijk via austin-group-l at The Open Group
          • Re... Joerg Schilling via austin-group-l at The Open Group
            • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
                • ... Harald van Dijk via austin-group-l at The Open Group
                • ... Joerg Schilling via austin-group-l at The Open Group
                • ... Harald van Dijk via austin-group-l at The Open Group
                • ... Stephane Chazelas via austin-group-l at The Open Group
                • ... Joerg Schilling via austin-group-l at The Open Group
                • ... Stephane Chazelas via austin-group-l at The Open Group
                • ... Stephane Chazelas via austin-group-l at The Open Group
                • ... Joerg Schilling via austin-group-l at The Open Group
                • ... Stephane Chazelas via austin-group-l at The Open Group
    • Re: Adding %n$... Robert Elz via austin-group-l at The Open Group

Reply via email to