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

Re: Back from locale hell ...



There seems to be a more aggressive or at least changed locale "stuff"
going on.  Based on what I've come to expect from years of Unix use,
the current behavior is wrong.  Sorting is case-insensitive.  Worse,
certain characters are DROPPED when sorting.  Help me understand why it
changed, why this is better, and how to control this behavior.

"Correct" behavior:

    % cat /etc/redhat-release
    Red Hat Linux release 6.2 (Zoot)
    % echo $SHELL
    /bin/bash
    % echo $BASH_VERSION
    1.14.7(1)
    % locale
    LANG=en_US
    LC_CTYPE="en_US"
    LC_NUMERIC="en_US"
    LC_TIME="en_US"
    LC_COLLATE="en_US"
    LC_MONETARY="en_US"
    LC_MESSAGES="en_US"
    LC_ALL=
    % touch a B c D e F
    % ls
    B  D  F  a  c  e
    % echo *
    B D F a c e
    % touch \!z \$C
    % ls
    !z  $C  B  D  F  a  c  e
    % echo *
    !z $C B D F a c e

7.0 has problems with globbing, but ls works.

    % cat /etc/redhat-release 
    Red Hat Linux release 7.0 (Guinness)
    % echo $SHELL
    /bin/bash
    % echo $BASH_VERSION
    2.04.11(1)-release
    % locale
    LANG=en_US
    LC_CTYPE="en_US"
    LC_NUMERIC="en_US"
    LC_TIME="en_US"
    LC_COLLATE="en_US"
    LC_MONETARY="en_US"
    LC_MESSAGES="en_US"
    LC_PAPER="en_US"
    LC_NAME="en_US"
    LC_ADDRESS="en_US"
    LC_TELEPHONE="en_US"
    LC_MEASUREMENT="en_US"
    LC_IDENTIFICATION="en_US"
    LC_ALL=
    % touch a B c D e F
    % ls
    B  D  F  a  c  e
    % echo *
    a B c D e F
    % LC_COLLATE=C echo *
    a B c D e F
    % LC_COLLATE= echo *
    a B c D e F
    % touch \!z \$C
    % ls
    !z  $C  ./  ../  B  D  F  a  c  e
    % echo *
    a B c $C D e F !z

Now it is switched, globbing works as I expect, ls is strange.  But at
least now I can control it with LC_COLLATE=C.

    # cat /etc/redhat-release
    Red Hat Linux release 7.0.91 (Wolverine)
    [root eng10 z]# echo $SHELL
    /bin/bash
    [root eng10 z]# echo $BASH_VERSION
    2.04.17(1)-release
    [root eng10 z]# locale
    LANG=en_US
    LC_CTYPE="en_US"
    LC_NUMERIC="en_US"
    LC_TIME="en_US"
    LC_COLLATE="en_US"
    LC_MONETARY="en_US"
    LC_MESSAGES="en_US"
    LC_PAPER="en_US"
    LC_NAME="en_US"
    LC_ADDRESS="en_US"
    LC_TELEPHONE="en_US"
    LC_MEASUREMENT="en_US"
    LC_IDENTIFICATION="en_US"
    LC_ALL=
    # touch a B c D e F
    [root eng10 z]# ls
    a  B  c  D  e  F
    [root eng10 z]# echo *
    B D F a c e
    [root eng10 z]# LC_COLLATE=C ls
    B  D  F  a  c  e
    [root eng10 z]# LC_COLLATE= ls
    a  B  c  D  e  F
    [root eng10 z]# touch \!z \$C
    [root eng10 z]# ls
    a  B  c  $C  D  e  F  !z
    [root eng10 z]# echo *
    !z $C B D F a c e
    [root eng10 z]# LC_COLLATE=C ls
    !z  $C  B  D  F  a  c  e

-- 
Jim Wright   Software Engineer   Penguin Computing





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