Problem
Under UnixWare, if I use the command:
# printf "%s " 09it correctly returns:# 09However if I use the command:# printf "%d " 09I get the error message:# UX: printf: WARNING: "09" expected numeric valueand then it does print the 0, but it never prints the 9.
Similarly, under SCO OpenServer, the same command returns the error message:
# printf: "09": not completely convertedand then it does print the 0, but fails to print the 9.
Why can't printf print variables with leading 0's? Cause
As in the printf function from the C language:
# /usr/bin/printf "%d " 09expects an OCTAL value.As such, values such as 01, 02, 03, 04, 05, 06, 07 will be printed accordingly, but values such as 08 and 09 are not valid. Hence /usr/bin/printf's behavior in this instance is the normal behavior, although the error message that results is somewhat cryptic.
Solution
The obscurity of the error message has been reported to SCO Engineering.
See also
printf(C)