Bug#513098: dd: please understand numbers in hexadecimal (0x...)

2009-01-26 Thread Jim Meyering
David Madore  wrote:
> Package: coreutils
> Version: 6.10-6
> Severity: wishlist
>
> dd is typically the sort of program where one would like to enter
> numbers (for bs, count, skip and seek) in hex (or possibly octal)
> format.  Unfortunately, dd won't parse them:
>
> pleiades david ~ $ dd if=/dev/zero bs=0x1000 count=1
> dd: invalid number `0x1000'
>
> Could you parse numbers as per scanf("%i",...) or strtoll(...,0)?

Hi David,

Since the shell already has a mechanism to do that,
(all POSIX-conforming ones do)

$ echo $((0x1000))
4096

How about letting *it* do the work:

dd if=/dev/zero bs=$((0x1000)) count=1

That's portable and works right away.
No need to wait for -- or rely on -- a patched/newer version of dd.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#513098: dd: please understand numbers in hexadecimal (0x...)

2009-01-26 Thread David Madore
Package: coreutils
Version: 6.10-6
Severity: wishlist

dd is typically the sort of program where one would like to enter
numbers (for bs, count, skip and seek) in hex (or possibly octal)
format.  Unfortunately, dd won't parse them:

pleiades david ~ $ dd if=/dev/zero bs=0x1000 count=1
dd: invalid number `0x1000'

Could you parse numbers as per scanf("%i",...) or strtoll(...,0)?

(I realize that octal is a possible breakage risk, because who knows
who numbers with leading zeroes for decimal, so I don't know what the
principle of least surprise says here; but parsing hex numbers would
really be useful.)

-- 
 David A. Madore
(david.mad...@ens.fr,
 http://www.madore.org/~david/ )



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org