Documentation
¶
Overview ¶
Package printf implements the `printf` built-in (/ §10.18 details).
The implementation handles the bash extensions Go's fmt does not:
- %b argument with backslash escapes interpreted (like echo -e)
- %q argument shell-quoted (single-quoted with escapes for ')
- %(FMT)T strftime-style timestamp; arg = epoch seconds, -1 = now, -2 = shell start
And the standard conversions %d, %i, %o, %u, %x, %X, %c, %s, %f, %e, %E, %g, %G, %%, with the usual flag/width/precision syntax. Bash format-reuse over extra args is implemented by cycling the format string until all args are consumed (printf "%s\n" a b c emits three lines).
mvdan/sh has its own printf builtin handled before our ExecHandler, so a bare `printf` invocation in a script never reaches us. This built-in serves `/bin/printf`, `command printf`, and direct dispatch via the registry for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.