[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
printf hex conversion gives wrong values
From: |
Thomas Weber |
Subject: |
printf hex conversion gives wrong values |
Date: |
Wed, 26 Jun 2002 11:28:06 +0200 |
Hi GNU sh-utils developers,
during developing a new shell script; I detected an erroneous behaviour
of the printf command.
printf fails on hex conversion for 008 and 009 and gives wrong values
for higher numbers, if the digit to convert contains leading zeroes.
Without leading zeroes the conversion succeeds.
echo $BASH_VERSION
2.04.21(1)-release
# printf "%02x\n" 001
01
# printf "%02x\n" 002
02
# printf "%02x\n" 003
03
# printf "%02x\n" 004
04
# printf "%02x\n" 005
05
# printf "%02x\n" 006
06
# printf "%02x\n" 007
07
# printf "%02x\n" 008
bash: printf: 008: invalid number
# printf "%02x\n" 009
bash: printf: 009: invalid number
# printf "%02x\n" 010
08
# printf "%02x\n" 011
09
Greetings
Thomas
- printf hex conversion gives wrong values,
Thomas Weber <=