[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf command refuses formatting string "08" using %02d
From: |
Li Zefan |
Subject: |
Re: printf command refuses formatting string "08" using %02d |
Date: |
Thu, 15 Nov 2007 10:46:00 +0800 |
User-agent: |
Thunderbird 2.0.0.0 (X11/20070419) |
Alexandre Campo wrote:
> Anyway, here is my problem (bash 3.2.25(1)-release (x86_64-pc-linux-gnu)):
>
> address@hidden:~/$ echo `printf "%02d" 08`
> bash: printf: 08: invalid number
> 00
> address@hidden:~/$ echo `printf "%02d" 04`
> 04
> address@hidden:~/$
>
>
> printf refuses to format 08 ... and not 04. Took a look at the code, but
> problem was not obvious.
> Gdb would be useful I guess.
>
> Please let me know if you can reproduce this problem, if you need more
> information, and if you have a solution :-)
> Thanks for your attention.
> Alexandre Campo
>
This is not a bug, because strings beginning with '0' are considered octal
numbers,
but 08 is not a valid octal number.
Li Zefan