bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf command refuses formatting string "08" using %02d


From: Eric Blake
Subject: Re: printf command refuses formatting string "08" using %02d
Date: Wed, 14 Nov 2007 19:42:44 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Alexandre Campo on 11/14/2007 7:32 PM:
> Printf refuses to tell me the version number... --help and --version flags 
> not working ???

Here's why --help and --version didn't work - you are using the bash
builtin, rather than coreutils' printf.  Try '/bin/printf --help' instead.

> 
> 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

That's bash's error message.  Coreutils' is slightly more informative:
$ /bin/printf %02d 08
/bin/printf: 08: value not completely converted
00

The leading 0 means you are using an octal number, but 8 is not a valid
octal digit, hence the parsing stops after '0' leaving '8' unparsed.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHO7Ik84KuGfSFAYARAqKDAJwOhzpdG8DWi7eY6Y38MrGHAt+AigCgjMr3
w4lN9gjrqvP4ZCm/mcHgHdA=
=HfQV
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]