Bash printf control characters
Paul Smith
paul at mad-scientist.net
Tue May 27 18:59:26 UTC 2014
On Tue, 2014-05-27 at 20:33 +0200, Johnny Rosenberg wrote:
> 2014-05-27 8:51 GMT+02:00 Patrick Asselman <iceblink at seti.nl>:
> In that case:
>
> printf "%-20s" söndag
> I didn't know that the - character was allowed. I wonder if that works
> with printf in C too…
Sure. That's been part of the C standard for printf() since the very
first ANSI standard was defined in 1989, and it was part of most/all C
runtimes before that (since they just standardized existing behavior for
the most part).
See man 3 printf and check out the section on field width.
More information about the ubuntu-users
mailing list