1 |
Apparently, though unproven, at 03:49 on Friday 07 January 2011, Stroller did |
2 |
opine thusly: |
3 |
|
4 |
> Hi there, |
5 |
> |
6 |
> Can anyone else reproduce this, please, or tell me what behaviour is |
7 |
> expected? |
8 |
> |
9 |
> $ locale |
10 |
> LANG=en_GB.UTF-8 |
11 |
> LC_CTYPE="en_GB.UTF-8" |
12 |
> LC_NUMERIC="en_GB.UTF-8" |
13 |
> LC_TIME=en_GB.UTF-8 |
14 |
> LC_COLLATE="en_GB.UTF-8" |
15 |
> LC_MONETARY="en_GB.UTF-8" |
16 |
> LC_MESSAGES="en_GB.UTF-8" |
17 |
> LC_PAPER="en_GB.UTF-8" |
18 |
> LC_NAME="en_GB.UTF-8" |
19 |
> LC_ADDRESS="en_GB.UTF-8" |
20 |
> LC_TELEPHONE="en_GB.UTF-8" |
21 |
> LC_MEASUREMENT="en_GB.UTF-8" |
22 |
> LC_IDENTIFICATION="en_GB.UTF-8" |
23 |
> LC_ALL= |
24 |
> $ date +"%l:%M%P" |
25 |
> 1:39 |
26 |
> $ LC_TIME="POSIX" |
27 |
> $ date +"%l:%M%P" |
28 |
> 1:39am |
29 |
> $ |
30 |
> |
31 |
> I had a single line of only LANG="en_GB.UTF-8" in /etc/env.d/02locale; |
32 |
> adding LC_TIME="POSIX" allows various scripts and stuff (I've written) to |
33 |
> show the date properly, but I think I read somewhere that this is bad. |
34 |
|
35 |
Your output looks fine, except for the last two commands. LC_TIME is an |
36 |
envvar, you have set it without exporting it, then ran data again and got a |
37 |
change. I don't understand how you managed that as LC_TIME would no longer be |
38 |
POSIX at that stage: |
39 |
|
40 |
$ cat /etc/env.d/02locale |
41 |
LANG="en_GB.utf8" |
42 |
$ locale |
43 |
LANG=en_GB.utf8 |
44 |
LC_CTYPE="en_GB.utf8" |
45 |
LC_NUMERIC="en_GB.utf8" |
46 |
LC_TIME="en_GB.utf8" |
47 |
LC_COLLATE="en_GB.utf8" |
48 |
LC_MONETARY="en_GB.utf8" |
49 |
LC_MESSAGES="en_GB.utf8" |
50 |
LC_PAPER="en_GB.utf8" |
51 |
LC_NAME="en_GB.utf8" |
52 |
LC_ADDRESS="en_GB.utf8" |
53 |
LC_TELEPHONE="en_GB.utf8" |
54 |
LC_MEASUREMENT="en_GB.utf8" |
55 |
LC_IDENTIFICATION="en_GB.utf8" |
56 |
LC_ALL= |
57 |
$ date +"%l:%M%P" |
58 |
8:16 |
59 |
$ LC_TIME="POSIX" |
60 |
$ date +"%l:%M%P" |
61 |
8:17 |
62 |
$ LC_TIME="POSIX" date +"%l:%M%P" |
63 |
8:18am |
64 |
|
65 |
|
66 |
As for the "correct" way and what is "bad", I've also read stuff. I've read |
67 |
lots and lots and lots of opinions, but not much fact. So here's my own mere |
68 |
opinion: |
69 |
|
70 |
It doesn't really matter where you set it as long as it gets the job done. |
71 |
Put it in conf.d to have it global. |
72 |
Put it in /etc/profile* to have it global for a shell |
73 |
Put it in ~/.profile* to set it for a single user. |
74 |
|
75 |
Or maybe you meant that you've read some people opine that setting just |
76 |
LC_TIME is bad? |
77 |
|
78 |
-- |
79 |
alan dot mckinnon at gmail dot com |