[Top][All Lists]

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

printf builtin differs from Solaris /usr/bin/printf

From: Mark Rainford
Subject: printf builtin differs from Solaris /usr/bin/printf
Date: Mon, 19 Nov 2001 14:04:34 GMT

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc'
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7'
-I/usr/local/depot/bash-2.03/include -g -O2
uname output: SunOS gen-off-3 5.7 Generic_106541-16 sun4u sparc SUNW,Ultra-60
Machine Type: sparc-sun-solaris2.7

Bash Version: 2.03
Patch Level: 0
Release Status: release

        bash builtin conversion using %d of a number with leading zeroes does
not convert from octal, nor does it recognise 0x1 as a hexadecimal number.
This differs from, say, Solaris /usr/bin/printf, and leads to confusion when
commands are tried out in bash before being used in a bourne shell script.

        print '%d' 011                  # prints "11"
        /usr/bin/printf '%d' 011        # prints "9"

        Bash builtin printf should probably evaluate numberic arguments as C
constant, as  described  by the ISO C standard; perhaps with an option to

 Regards, Mark.

reply via email to

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