[Top][All Lists]

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

Re: sort -nu: bug or feature?

From: Chris F.A. Johnson
Subject: Re: sort -nu: bug or feature?
Date: Thu, 9 Sep 2004 00:07:06 -0400 (EDT)

On Wed, 8 Sep 2004, Paul Eggert wrote:

"Chris F.A. Johnson" <address@hidden> writes:

     "sort -n" uses a string comparison after aligning the numbers on
     the decimal point, but -u apparently uses a (non-POSIX) numeric
     comparison to determine equivalency:

It's the same comparison, and it conforms to POSIX as far as I can see.
If not, please let us know exactly what the failure-to-conform is.

$ printf "%s\n" 1 01 08 8 | sort -nu

    If it's a string comparison, 08 is not the same as 8, therefore
    the comparison is numeric.

    Does POSIX not require a number with a leading 0 to be interpreted
    as octal? As in:

$ echo $(( 08 ))
bash: 08: value too great for base (error token is "08")

        Chris F.A. Johnson                      http://cfaj.freeshell.org
                Everything in moderation -- including moderation

reply via email to

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