On 08/10/10 17:15, Philip Ganchev wrote:
> On a related note, couldn't all GNU programs (such as "du" and "ls")
> be made to print (and read?) numbers and dates formatted according to
> the locale setting, including thousands-separators, etc? That would
> avoid having a special option for every program.

BLOCK_SIZE can be used to control a few output formats:

export BLOCK_SIZE=\'1; export LC_ALL=de_DE.utf8

$ \ls -ld .
drwxrwxr-x. 4 padraig padraig 4.096 15. Sep 23:04 .
$ du -s .
15.368.192
$ df .
Dateisystem          1B-Blöcke   Benutzt Verfügbar Ben% Eingehängt auf
/dev/sda5            5.155.188.736 4.930.887.680 171.970.560  97% /

I do notice that stat doesn't pass on a single
quote to the underlying printf to get locale specific output.
Maybe we want to support that?

$ stat -c%\'s .
?s

$ stat -c%08s .
00004096


Also sort can read locale specific separators:

$ printf '1 234\n1 123\n' | LC_ALL=fr_FR.utf8 sort --debug -sn
sort: using `fr_FR.utf8' sorting rules
1 123
_____
1 234
_____

As for dates, it's hard enough to read in a single
locale, never mind supporting multiple locales.

cheers,
Pádraig.


Reply via email to