dougo: (Default)
dougo ([personal profile] dougo) wrote2004-05-26 11:33 am

Debian Linux question

Is it my imagination, or did /bin/ls used to sort by case? Now it puts, for example, "README" down among the "r"s instead of before all lowercase filenames. When did this change? Is this a concession to Windows case-insensitivity or something?

[identity profile] dougo.livejournal.com 2004-05-26 04:26 pm (UTC)(link)
OK, "setenv LC_COLLATE POSIX" works. I'm not sure I want all sorting to be in ASCII order, though, just ls. I guess eventually I'll find out what other programs respect locale.

By the way, here's a footnote from the ls info page:
   (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to
`en_US'), then `ls' may produce output that is sorted differently than
you're accustomed to.  In that case, set the `LC_ALL' environment
variable to `C'.
I guess the defaults changed or something, because I don't have `LC_ALL' set.

[identity profile] ghudson.livejournal.com 2004-05-26 04:30 pm (UTC)(link)
It's more common to have LANG set than LC_ALL. As I understand it, LC_ALL overrides {LC_COLLATE/LC_TIME/etc.} which overrides LANG, so you'd only set LC_ALL if, say, you're a script and want predictable output behavior.

(Unix locale stuff is very confusing and poorly documented in my experience. Fortunately, the average user only has to interact with it through a language-selection screen at system install time.)

[identity profile] mshonle.livejournal.com 2004-05-26 04:57 pm (UTC)(link)
alias ls (setenv LC_COLLATE POSIX; ls \!*)

(or something to that effect)

[identity profile] jfb.livejournal.com 2004-05-26 05:09 pm (UTC)(link)
You could try aliasing ls to 'env LC_COLLATE=POSIX ls'. Or whatever.

[identity profile] mshonle.livejournal.com 2004-05-27 06:54 am (UTC)(link)
GMTA!