You are not logged in.

#1 2010-05-12 18:13:45

loserMcloser
Member
From: Canada
Registered: 2004-12-15
Posts: 130

ls sort order

> touch @ @a 0 0a
> ls -1
@
0
0a
@a

Huh? If @ comes before 0, shouldn't @a come before 0a ???  tongue

Offline

#2 2010-05-12 18:37:05

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: ls sort order

» echo $LC_COLLATE
C
» ls -1
0
0a
@
@a

Offline

#3 2010-05-12 18:37:36

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,799
Website

Re: ls sort order

odd.

//blue/0/~/ echo -e "@\n@a\n0\n0a" | sort
@
0
0a
@a
//blue/0/~/ echo -e "@\n@a\n0\n0a" | LC_ALL=C sort
0
0a
@
@a

Offline

#4 2010-05-12 18:43:14

kazuo
Member
From: São Paulo/Brazil
Registered: 2008-03-18
Posts: 413
Website

Re: ls sort order

This is locale dependent (LC_COLLATE). C give '0 0a @ @a' what are you using? en_CA? Look at http://www.iso.org/iso/iso_catalogue/ca … mber=44872 for descrition of sorting order (some additions are made in the locale look at /usr/share/i18n/locales)

Offline

#5 2010-05-12 18:45:09

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ls sort order

@ and many other characters translate as an empty string in LC_COLLATE=en_US.utf8

Offline

#6 2010-05-12 19:02:42

loserMcloser
Member
From: Canada
Registered: 2004-12-15
Posts: 130

Re: ls sort order

Procyon wrote:

@ and many other characters translate as an empty string in LC_COLLATE=en_US.utf8

Aha, thanks. echo $LC_COLLATE gave a blank, so I guess it was determined by LOCALE="en_US.utf8" in rc.conf.

Also found some useful info here.

I now have export LC_COLLATE=C in ~/.zshrc 

Cheers!

Offline

Board footer

Powered by FluxBB