help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Where is LANG set?


From: Greg Wooledge
Subject: Re: [Help-bash] Where is LANG set?
Date: Mon, 8 Jul 2019 11:09:29 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Mon, Jul 08, 2019 at 08:55:31AM -0400, Tim Visher wrote:
> On Mon, Jul 8, 2019 at 7:07 AM Peng Yu <address@hidden> wrote:
> 
> > When I run a noninteractive session of bash via a cron job, LANG is
> > not set. But when I run an interactive session of bash, LANG is set.
> > Does anybody know where LANG is set. (My test is on Mac OS.)
> 
> 
> I believe that's set by Terminal.app if you're using that. I don't think
> it's configured using standard /etc files.

It's specific to each operating system.  Peng Yu should ask on a Mac OS X
mailing list for details.

On most Linux-based systems, it's set by a PAM module during login.
This may or may not be the case on Mac OS X -- I have no idea.

One should generally assume that crontab jobs are run in the C (POSIX)
locale, without any controlling terminal, without any TERM variable, with
an extremely bare PATH variable; and that the crontab lines themselves
are parsed by /bin/sh.  There are systems where some or all of these
things may be overridden by the end user, but it's usually better just
to assume the base defaults and work with them, to avoid trouble in the
future.

(That has nothing to do with how locale variables are set for login
sessions, but the quoted question seems to be primarily about cron,
not about logins, so I figured it's worth pointing out.  Then again,
it's Peng Yu, so good luck figuring out what the real question is.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]