Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #267450

Re: Does "LC_ALL=C" work on all shells?

From David Wright <deblis@lionunicorn.co.uk>
Newsgroups linux.debian.user
Subject Re: Does "LC_ALL=C" work on all shells?
Date 2024-02-16 03:40 +0100
Message-ID <I7WiR-arrD-9@gated-at.bofh.it> (permalink)
References (3 earlier) <I78YN-9XAm-7@gated-at.bofh.it> <I79rP-9XZD-7@gated-at.bofh.it> <I7q9j-a88U-3@gated-at.bofh.it> <I7zFD-adNg-3@gated-at.bofh.it> <I7Qn7-anYX-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 15 Feb 2024 at 21:17:44 (+0100), Franco Martelli wrote:
> On 15/02/24 at 03:28, Max Nikulin wrote:
> > > # env LC_ALL=C script -t 2>~/upgrade-bookwormstep.time -a
> > > ~/upgrade-bookwormstep.script
> > 
> > Perhaps LC_ALL=C.UTF-8 is safer. At least several years ago some
> > python scripts (unrelated to Debian upgrade however) failed trying
> > to log e.g. non-ascii file paths, etc.
> > 
> > I would reset LANGUAGE as well otherwise some programs may use
> > localized messages.
> > 
> > Finally, some users might have LC_ALL (despite it is not
> > recommended) or LANGUAGE set in a file like ~/.bashrc. That is why
> > the following approach may be more reliable. Run commands within
> > the "script" session
> > 
> >      LANG=C.UTF-8; LANGUAGE=; export LANG LANGUAGE
> > 
> > with a note concerning csh. To affect messages generated by shell
> > itself, "export" is separated from setting of the variables.
> 
> Doesn't LC_ALL=C setting override LANG or LANGUAGE settings? On my
> system I have:
> 
> ~$ env | grep LANG
> LANGUAGE=
> LANG=it_IT.UTF-8

BTW, you can also print locale information with:

  $ locale
  LANG=C.UTF-8
  LANGUAGE=
  LC_CTYPE=en_GB.UTF-8
  LC_NUMERIC="C.UTF-8"
  LC_TIME="C.UTF-8"
  LC_COLLATE="C.UTF-8"
  LC_MONETARY="C.UTF-8"
  LC_MESSAGES="C.UTF-8"
  LC_PAPER="C.UTF-8"
  LC_NAME="C.UTF-8"
  LC_ADDRESS="C.UTF-8"
  LC_TELEPHONE="C.UTF-8"
  LC_MEASUREMENT="C.UTF-8"
  LC_IDENTIFICATION="C.UTF-8"
  LC_ALL=
  $ 

> and LC_ALL=C override the LANG setting when used inline of the
> command. This approach is to cover all cases, my goal is to do
> apt/apt-get commands output in English when they are executed into a
> "script" session.

Yes, LC_ALL=C will override all the locale variables,
but LC_ALL=C.UTF-8 will not:

  $ LC_ALL=C.UTF-8 LANGUAGE=it LANG=it_IT.UTF-8 aptitude why firefox-esr
  i   firefox-esr-l10n-en-gb Dipende firefox-esr (< 115.7.0esr-1~deb11u1.1~)
  $ LC_ALL=C LANGUAGE=it LANG=it_IT.UTF-8 aptitude why firefox-esr
  i   firefox-esr-l10n-en-gb Depends firefox-esr (< 115.7.0esr-1~deb11u1.1~)
  $ 

Cheers,
David.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-13 21:50 +0100
  Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-13 22:00 +0100
    Re: Does "LC_ALL=C" work on all shells? Nicolas George <george@nsup.org> - 2024-02-13 22:10 +0100
      Re: Does "LC_ALL=C" work on all shells? Will Mengarini <seldon@eskimo.com> - 2024-02-13 23:00 +0100
        Re: Does "LC_ALL=C" work on all shells? Nicolas George <george@nsup.org> - 2024-02-13 23:30 +0100
          Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-14 17:20 +0100
            Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-14 17:20 +0100
              Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-14 17:40 +0100
                Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-14 17:50 +0100
                Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-14 21:50 +0100
                Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-14 22:00 +0100
            Re: Does "LC_ALL=C" work on all shells? Max Nikulin <manikulin@gmail.com> - 2024-02-15 03:30 +0100
              Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-15 21:20 +0100
                Re: Does "LC_ALL=C" work on all shells? Max Nikulin <manikulin@gmail.com> - 2024-02-16 03:10 +0100
                Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-16 17:40 +0100
                Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-16 17:50 +0100
                Re: Does "LC_ALL=C" work on all shells? <tomas@tuxteam.de> - 2024-02-16 19:30 +0100
                Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-16 22:30 +0100
                Re: Does "LC_ALL=C" work on all shells? Max Nikulin <manikulin@gmail.com> - 2024-02-17 04:20 +0100
                Re: Does "LC_ALL=C" work on all shells? David Wright <deblis@lionunicorn.co.uk> - 2024-02-16 03:40 +0100
                Re: Does "LC_ALL=C" work on all shells? Max Nikulin <manikulin@gmail.com> - 2024-02-16 04:10 +0100
                Re: Does "LC_ALL=C" work on all shells? Teemu Likonen <tlikonen@iki.fi> - 2024-02-16 08:20 +0100
                Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-16 13:20 +0100
                Re: Does "LC_ALL=C" work on all shells? Franco Martelli <martellif67@gmail.com> - 2024-02-16 17:40 +0100
  Re: Does "LC_ALL=C" work on all shells? Nicolas George <george@nsup.org> - 2024-02-13 22:00 +0100
  Re: Does "LC_ALL=C" work on all shells? Nicolas George <george@nsup.org> - 2024-02-13 22:30 +0100
  Re: Does "LC_ALL=C" work on all shells? conover@panix.com (John Conover) - 2024-02-13 22:30 +0100
    Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-13 22:50 +0100
      Re: Does "LC_ALL=C" work on all shells? Nicolas George <george@nsup.org> - 2024-02-13 23:50 +0100
        Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-14 00:00 +0100
        Re: Does "LC_ALL=C" work on all shells? Gremlin <scott-andrews@columbus.rr.com> - 2024-02-14 01:40 +0100
          Re: Does "LC_ALL=C" work on all shells? Andy Smith <andy@strugglers.net> - 2024-02-14 01:50 +0100
          Re: Does "LC_ALL=C" work on all shells? Gremlin <scott-andrews@columbus.rr.com> - 2024-02-14 02:00 +0100
            Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-14 02:20 +0100
            Re: Does "LC_ALL=C" work on all shells? Max Nikulin <manikulin@gmail.com> - 2024-02-14 03:30 +0100
              Re: Does "LC_ALL=C" work on all shells? Gremlin <scott-andrews@columbus.rr.com> - 2024-02-14 03:50 +0100
                Re: Does "LC_ALL=C" work on all shells? Greg Wooledge <greg@wooledge.org> - 2024-02-14 04:20 +0100
                Re: Does "LC_ALL=C" work on all shells? Gremlin <scott-andrews@columbus.rr.com> - 2024-02-14 11:30 +0100
      Re: Does "LC_ALL=C" work on all shells? Gremlin <scott-andrews@columbus.rr.com> - 2024-02-13 23:50 +0100

csiph-web