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

Re: ls -l format changed ?



Hi,

At Mon, 01 Jul 2002 17:44:32 +0400,
Nikita V. Youshchenko <yoush@cs.msu.su> wrote:
> 
> >> I've used to use
> >> 
> >>   ls -l xxx | awk '{print($11)}'
> >> 
> >> to dereference symlinks from shell scripts.
> > 
> > ...that's fundamentally broken. You *should not* depend on
> > locale-dependent output. You'll have somewhat better luck depending on
> > the output of the "C" locale, which is more standardized. (But such a
> > dependency will still not necessarily be portable and doing this is not
> > recommended.)
> 
> I always work with ru_RU.KOI8-R locale. I am aware of some locale-related 
> problems. But ls -l format was not dependent on locale before today.

In "C" locale, "ls -l" seems to work in American way in order to keep
backward compatibility.

In other locales, it seems to work in ISO date format.

Now, locale means LC_TIME locale, which is determined by LANG,
LC_TIME, and LC_ALL variables (later is stronger).

I think the reasons of usage of ISO date format (not using LC_TIME
format) are:

(1) "ls -l" has to control column number.

(2) "ls -l" wants to determine what information (year? month?
    minute?) in the limited number of columns.

(3) "Months are called in names and dates are in numbers" is
    a local custom in European languages.  Thus, (for example)
    "%b %d" format is *not* fully international.

Because of (1) and (2), "ls -l" cannot use "%c", "%x", "%X", or
other formats.  This is why "ls -l" has to have its own date/time
formatter.  (See "date --help" for explanation of date/time format).

Thus, ISO format is what people in various countries can equally 
tolerate, though not very familiar.  "%b %d" format is unequal
because it fully meets European-languages-speakers but (at least)
east Asian people don't recognize the format.

In "C" locale, the format is unchanged.  Thus LC_ALL=C should be
used in script files where locale is not used, because any human-
readable outputs of any commands (including "ls") can be
internationalized.

---
Tomohiro KUBOTA <kubota@debian.org>
http://www.debian.or.jp/~kubota/
"Introduction to I18N"  http://www.debian.org/doc/manuals/intro-i18n/


-- 
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: