I am formatting numbers in a bash script with printf
printf "%04d" $input # four digits width with leading zeros if shorter
If input="011"
printf assumes the value is octal and returns 0009
instead of 0011
.
Is it possible to force printf to assume all values are decimal?
Prefix the value with a base specifier of
10#
.