The Full Story on printf
We introduced the printf command in Section 2.5.4. This section completes the description of that command.
As we saw earlier, the full syntax of the printf command has two parts:
printfformat-string
[arguments ...
]
The first part is a string that describes the format
specifications; this is best supplied as a string constant in quotes.
The second part is an argument list, such as a list of strings or
variable values, that correspond to the format specifications. The
format string combines text to be output literally with specifications
describing how to format subsequent arguments on the printf command line. Regular characters are
printed verbatim. Escape sequences, similar to those of echo, are interpreted and then output as the
corresponding character. Format specifiers, which
begin with the character %
and end
with one of a defined set of letters, control the output of the
following corresponding arguments. printf's escape sequences are described in ...
Get Classic Shell Scripting now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.