printf

If your output vocabulary and style needs another level of maturation, the Korn Shell provides the printf command. The “f” in printf stands for “formatted.” So, this command provides some formatting options for your output. It can handle floating-point displays, integer displays, and string displays. If this is starting to sound familiar to you C language programmers out there, it should. The printf command is based on the printf function available in the standard C library.

Its syntax includes a quoted format section followed by the variables to be placed in the formatted specification. The format string can contain zero or more control variables, which will be replaced by the respective variables at the end of the command line.

The control ...

Get Korn Shell Programming by Example 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.