A
A
andyceo2012-10-11 11:30:07
bash
andyceo, 2012-10-11 11:30:07

Command output in a language other than the server's locale?

My server has a Russian locale, some commands have a translation into Russian and, accordingly, display information in Russian. I am writing a script in which this info is parsed. The script can be run on a server with a locale other than English/Russian/etc, and the parsing will fail.
Therefore, I need a way to ensure that in a script for a specific command it is executed in a strictly defined locale (eng), so that no matter on which server and with what locale it is launched, its output would always be in the same language, so that parsing the output always passed and it would not be necessary to write parsing for different languages.
Example:
svn info URL
URL: MyURL Repository
Root: svn://root/repo
Repository UUID: 5e7d134a-54fb-0310-bd04-b611643e5c25
Revision: 500
...
but you need:
svn info URL
URL: MyURL
Repository Root: svn://root/repo
Repository UUID: 5e7d134a-54fb-0310-bd04-b611643e5c25
Revision: 500
so that in the script I wrote something like:
REV=`svn info $ URL |grep Revision: | awk '{print $2}'`
Specifically, about svn info, I know about the existence of the --xml key, which is independent of the language and can be parsed, but I'm interested in a more general case.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2012-10-11
@andyceo

Setting the LANG variable to the right value doesn't help?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question