Date: Sun, 19 Apr 2020 15:40:39 -0400 From: Chet Ramey <chet.ra...@case.edu> Message-ID: <8c5bdd2c-bc61-a885-6a05-690ef7f51...@case.edu>
| Nobody, including POSIX, is rational, then. There is no %q in POSIX printf currently, so the issue does not arise there, and in any case, its objective is not to be rational, but to document what works - and in the existing implementations of printf %q (or the ones I have seen) giving a precision for %q conversions doesn't work in a rational way. Sanely, printf %W.Pq arg would be processed as printf %Ws $( quote $( printf %.Ps arg ) ) rather than as printf %W.Ps $( quote $( printf %s arg ) ) which is what we all do (the NetBSD printf doesn't have %q - I have it implemented, but refuse to commit it because this is just so ugly, and I'm much too lazy to do it properly). kre ps: in the above, supply shell quoting as needed - I omitted it to avoid quoting confusion... and "W' and "P" stand for the (optional) width and precision values (numbers, or '*').