manpagez: man pages & more
info gettext
Home | html | info | man

File: gettext.info,  Node: sh-format,  Next: awk-format,  Prev: ruby-format,  Up: Translators for other Languages

16.3.15 Shell Format Strings
----------------------------

   There are two kinds of format strings in shell scripts: those with
dollar notation for placeholders, called _Shell format strings_ and
labelled as ‘sh-format’, and those acceptable to the ‘printf’ command
(or shell built-in command), called _Shell ‘printf’ format strings_ and
labelled as ‘sh-printf-format’.

   Shell format strings, as supported by GNU gettext and the ‘envsubst’
program, are strings with references to shell variables in the form
‘$VARIABLE’ or ‘${VARIABLE}’.  References of the form
‘${VARIABLE-DEFAULT}’, ‘${VARIABLE:-DEFAULT}’, ‘${VARIABLE=DEFAULT}’,
‘${VARIABLE:=DEFAULT}’, ‘${VARIABLE+REPLACEMENT}’,
‘${VARIABLE:+REPLACEMENT}’, ‘${VARIABLE?IGNORED}’,
‘${VARIABLE:?IGNORED}’, that would be valid inside shell scripts, are
not supported.  The VARIABLE names must consist solely of alphanumeric
or underscore ASCII characters, not start with a digit and be nonempty;
otherwise such a variable reference is ignored.

   Shell ‘printf’ format strings are the format strings supported by the
POSIX ‘printf’ command
(),
including the floating-point conversion specifiers ‘a’, ‘A’, ‘e’, ‘E’,
‘f’, ‘F’, ‘g’, ‘G’, but without the obsolescent ‘b’ conversion
specifier.  Extensions by the GNU coreutils ‘printf’ command
()
are not supported: use of the ‘'’ flag in the ‘%i’, ‘%d’, ‘%u’, ‘%f’,
‘%F’, ‘%g’, ‘%G’ directives; use of ‘*’ or ‘*M$’ as width or precision;
use of size specifiers ‘h’, ‘l’, ‘j’, ‘z’, ‘t’ (ignored); and the escape
sequences ‘\c’, ‘\xNN’, ‘\uNNNN’, ‘\UNNNNNNNN’.  Extensions by the GNU
bash ‘printf’ built-in
()
are not supported either: use of ‘*’ as width or precision; use of size
specifiers ‘h’, ‘l’, ‘j’, ‘z’, ‘t’ (ignored); the ‘%b’, ‘%q’, ‘%Q’,
‘%T’, ‘%n’ directives; and the escape sequences ‘\xNN’, ‘\uNNNN’,
‘\UNNNNNNNN’.

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.