Computer Association of SIUE - Forums

CAOS Forums => Questions and Answers => Topic started by: Jon on 2005-11-07T14:23:32-06:00 (Monday)

Title: fixing output of 'ls'
Post by: Jon on 2005-11-07T14:23:32-06:00 (Monday)
I've been a bit annoyed with the output of 'ls' on my web hosting service.  For some reason, it seems that someone decided that ls should sort its output without case sensitivity rather than the old fashioned method (which I prefer) when the locale is set to "en-US" (i.e., it intermixes hidden files with non-hidden files, so I've got .ssh/ listed right before stuff/ and right after socketcode/).  Why would anyone want to do this?

If this behavior annoys you, too, be sure to set your locale to POSIX or to nothing.

export LANG=POSIX
or
export LANG=

While looking for this solution, I stumbled upon this page (http://lists.gnu.org/archive/html/bug-fileutils/2001-05/msg00018.html).  I'm not sure why, but this sure made me smile.
Title: Re: fixing output of 'ls'
Post by: William Grim on 2005-11-07T14:27:12-06:00 (Monday)
If you want to unset the value of an environment variable such as LANG, I would do
unset LANG
instead of just
export LANG=
because there may be some code that will go ahead and try to use the empty LANG string instead of ignoring the string and using a default value.  This may cause some programs to crash (none that I know).