2

I'm writing some software that uses the output of some system (linux) commands.

Problem is, it fails with languages other than english.

Is there a way to run linux commands and be sure that they'll run in English?

There's a 90% solution here, with an exception handled here

But neither shows a fail-safe way of ensuring a command is executed in English

For convenience, the 90% solution was to prepend commands with LANG=C

The exception handles for when LANGUAGE environment is aleady defined (then it will take priority over LANG, in which case prepending commands with LANGUAGE=C will solve.

Not sure how to solve for both cases? (I guess prepending LANG=C LANGUAGE=C)

5
  • 2
    It looks like you already have a solution.
    – larsks
    Commented Jan 25, 2020 at 12:38
  • @larsks i am not so sure. There could be other conditions that override the above two, things I am not aware of
    – stevec
    Commented Jan 25, 2020 at 12:40
  • 1
    Doesn't LC_ALL=C cmd solve your problem?
    – user232326
    Commented Jan 25, 2020 at 13:05
  • @Isaac according to here it won't if LANGUAGE is set
    – stevec
    Commented Jan 25, 2020 at 13:07
  • 4
    Then use LANGUAGE=C LC_ALL=C cmd or, maybe: unset LANGUAGE; LC_ALL=C cmd
    – user232326
    Commented Jan 25, 2020 at 13:13

0

You must log in to answer this question.

Browse other questions tagged .