0

I'm running a script that contains the LANG variable set to 'french', when i run it manually with

$(pwd)/script_name

It works fine, for example, i see the "e'" translated properly, but when is run by a cronjob, It seems like the LANG variable is set to english_us, i see the 'e`' as '?'

I have no idea why this happens,even when running from a cronjob, the script should set its LANG to french, as it does when i run it manually. Any advice?

6
  • Are you sure it's not inheriting it from your .profile? Commented Nov 20, 2013 at 10:05
  • nope, there's no declaration of LANG in .bash_profile Commented Nov 20, 2013 at 10:10
  • Do you set any other locale-related environment variables in your .bash_profile or .bashrc? Commented Nov 20, 2013 at 10:11
  • no, just double checked, no locale-related vars are set Commented Nov 20, 2013 at 10:13
  • Is it possible to set LANG=french within $(pwd)/script_name ? Commented Nov 20, 2013 at 10:21

2 Answers 2

1

You can set environment variables right on the command line within your crontab, like so:

* * * * * LANG=french script_name
Sign up to request clarification or add additional context in comments.

Comments

0

I needed to set the environment variable of the process running the script using "export" so it needed to be : export LANG=french, got this from https://superuser.com/a/153378/257000

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.