Subject: Re: printf(1) argument doesn't accept hexadecimal
To: Jeremy C. Reed <reed@reedmedia.net>
From: Jason R Thorpe <thorpej@zembu.com>
List: netbsd-help
Date: 07/20/2001 12:42:50
On Fri, Jul 20, 2001 at 12:32:57PM -0700, Jeremy C. Reed wrote:
> I wanted to convert the decimal number from a hexadecimal using printf.
>
> $ printf "%d\n" 0xC0
> bash: printf: 0xC0: illegal number
> $ printf "%x\n" 192
> c0
> $ perl -e 'printf "%d\n",0xC0'
> 192
>
> Can printf(1) use non-decimal for argument?
yeah-baby:thorpej 163$ printf "%d\n" 0xC0
192
yeah-baby:thorpej 164$
--
-- Jason R. Thorpe <thorpej@zembu.com>