Stephane Chazelas via austin-group-l at The Open Group wrote in <20230901181024.pwx4plwclz7ij...@chazelas.org>: |2023-09-01 07:54:02 -0500, Eric Blake via austin-group-l at The Open Group: ... |> How many scripts in the wild actually use %b, though? And if there |> are such scripts, anything we can do to make it easy to do a drop-in |> replacement that still preserves the old behavior (such as changing %b |> to %#s) is going to be easier to audit than the only other |> currently-portable alternative of actually analyzing the string to see |> if it uses any octal or \c escapes that have to be re-written to |> portably function as a printf format argument. |[...] | |FWIW, a "printf %b" github shell code search returns ~ 29k |entries |(https://github.com/search?q=printf+%25b+language%3AShell&type=code&l=Sh\ |ell) | |That likely returns only a small subset of the code that uses |printf with %b inside the format and probably a few false |positives, but that gives many examples of how printf %b is used |in practice.
Actually this returns a huge amount of false positives where printf(1) and %b are not on the same line, let alone the same command, if you just scroll down a bit it starts like neovim match pr_title="${pr_title// /,}" # Replace spaces with commas. pr_title="$(printf 'vim-patch:%s' "${pr_title#,}")" (bash only btw). Furthermore it shows a huge amount of false use cases like printf >&2 "%b\n" "The following warnings and non-fatal errors were encountered during the installation process:" This is only the first result page. It seems people think you need this to get colours mostly, which then, it has to be said, is also practically mislead. (To the best of *my* knowledge that is.) Ah it is a copy&paste world, and for one Stephane at stackoverflow there are 99 that fool and mislead you, or do not know for sure themselves, but also copy and paste! --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)