Home > front end >  How to set language in bash script
How to set language in bash script

Time:09-30

In MacOS: I have a working shell script where I use the "date" command for logging: $> date >> Log

This reports the following (dutch) when I execute the script from the termional window: do 29 sep 2022 15:02:03 CEST

When I run this from cron I get: Thu Sep 29 14:00:08 CEST 2022

How do I set the language and format to Dutch?

CodePudding user response:

To set your current shell to a different language you use the bash variable LANG followed by the language you want:

LANG=nl_BE

If you want to set that so its used every time add an export line to your .bashrc for that user. The .bashrc file can be found in each user's homedir, if they don't have one you can create it:

export LANG=nl_BE

The command locale will show you information about locale on the server. The command locale -a will give you a list of all the locale you can use.

  • Related