We all know, that locale would be
a problem when scripting in e.g. bash.
For example, when LC_COLLATE
is not set to "C", echo [a-z] could also
show filenames like "A", "B" (not only
lowecase).
All (or almost all) materials I have read
have told that it is usefull to set "LANG=C"
when scripting.
My questing is, why to set LANG=C,
not other variables?
Maybe it is better to set LC_ALL=C
(LC_ALL has "higher priority" than LANG)
or LC_COLLATE (LC_COLLATE has
also "higher priority" than LANG)?
Thanks in advance for your answer.
Regards,
Robbo
I had some scripts that would check if day of the week is a certain
day like Sunday, and they did not work on a computer who was set to
use Russian language.
i
--
Due to extreme spam originating from Google Groups, and their inattention
to spammers, I and many others block all articles originating
from Google Groups. If you want your postings to be seen by
more readers you will need to find a different means of
posting on Usenet.
http://improve-usenet.org/
The folks on comp.unix.shell are much more
likely to be able to give you an answer here.
Sid
>> All (or almost all) materials I have read
>> have told that it is usefull to set "LANG=C"
>> when scripting.
>> My questing is, why to set LANG=C,
>> not other variables?
>> Maybe it is better to set LC_ALL=C
>> (LC_ALL has "higher priority" than LANG)
>> or LC_COLLATE (LC_COLLATE has
>> also "higher priority" than LANG)?
Yes, the priorities decrease from LC_ALL over LC_* to LANG.
But you should set LC_ALL only for debugging or in severe cases,
because you can't make use of any of the individual categories
anymore (for example LC_CTYPE for special characters).
You are right: If LC_COLLATE is explicitly set, LANG won't help.
You certainly could override it with LC_ALL, but you should
simply adjust LC_COLLATE itself.
There is a rarely documented feature, which helps finding
(and adjusting) the very settings immediately: implicit
assignments are denoted with quotes.
In the following, only LANG and LC_CTYPE are set explicitly.
All other categories follow the setting of LANG and thus their
values are quoted:
$ locale
LANG=en_US
LC_CTYPE=en_US
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_ALL=
[not linux specific: followups redirected to comp.unix.shell]
--
Isn't it conceivable to you that an intelligent person could harbor
two opposing ideas in his mind?
-- Adlai Stevenson, to reporters