printf: Don't print an error if not given an argument

This commit is contained in:
Fabian Homborg
2020-05-18 19:34:53 +02:00
parent 3cfcbe0975
commit 56f24f08d7
4 changed files with 9 additions and 2 deletions

View File

@@ -59,7 +59,9 @@ printf also knows a number of backslash escapes:
- ``\uhhhh`` 16-bit Unicode character (hhhh is 4 digits)
- ``\Uhhhhhhhh`` 32-bit Unicode character (hhhhhhhh is 8 digits)
The ``format`` argument is re-used as many times as necessary to convert all of the given arguments. If a format specifier is not appropriate for the given argument, an error is printed. For example, ``printf '%d' "102.234"`` produces an error, as "102.234" cannot be formatted as an integer.
The ``format`` argument is re-used as many times as necessary to convert all of the given arguments. If the given argument doesn't work for the given format, an error is printed. For example, ``printf '%d' "102.234"`` produces an error, as "102.234" cannot be formatted as an integer. printf will then also return non-zero.
It will also return non-zero if no argument at all was given, in which case it will print nothing.
This file has been imported from the printf in GNU Coreutils version 6.9. If you would like to use a newer version of printf, for example the one shipped with your OS, try ``command printf``.