Well, that works up to a point. Fore some, that point might be considered a bit too close to zero...
$ printf "%d\n" 009
sh: 1: printf: 009: not completely converted
0
Re:Problem solving with Unix commands
by jandrese on Thursday February 14, 2019 @11:23AM
(#19163087)
0-prefix octal notation continues to be a mistake.
I love when programs mysteriously fail when passed an IP address like 192.168.001.009.
Thankfully modern tools have been moving away from supporting that notation and are less likely to explode all over unsuspecting users.
Re:Problem solving with Unix commands
by neokantian on Thursday February 14, 2019 @11:30AM
(#19163150)
Yes, you are right. This seems to work better:
$ printf "%1.0f\n" 009
9
$ printf "%1.0f\n" 00125990
125990
$ printf "%d\n" 003
3