Public bug reported:
Binary package hint: coreutils
Ubuntu 7.10, coreutils 5.97-5.3ubuntu3.
coreutils' printf(1) and bash(1)'s built-in printf don't handle `%c'
in the expected way. Instead, it treats it as `%.1s'.
$ type printf
printf is a shell builtin
$ /usr/bin/printf %c 65
6$
$ printf %c 65
6$
$ /usr/bin/printf %.1s 65
6$
$ awk 'BEGIN {printf("%c", 65)}' </dev/null
A$
$
C, awk, Python, Perl, etc., all work as expected. As it stands, there's
no easy way of turning $foo containing "65" into "A". printf(1) does
accept
$ printf \\x41
A$
$
but that's not the same thing.
As with %d, printf(1) should turn the string argument "65" into an
integer before passing to printf(3).
** Affects: coreutils (Ubuntu)
Importance: Undecided
Status: New
--
printf(1) %c doesn't work as expected, instead like %.1s.
https://bugs.launchpad.net/bugs/225637
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs