I've had a few issues with environmental variables not set correctly in my Raspbmc Raspberry Pi. Specifically, I've had to manually specify the following in ~/.bashrc
.
export LANG='en_AU.UTF-8"
export LANGUAGE='en_AU:en'
export MAIL='/var/mail/pi'
However, in another Pi running vanilla Raspbian, these environmental variables are set correctly. I wanted to see what file specified these, but couldn't find it. I tested the files that I know of that run when logging in to a terminal. These gave no hits.
grep LANG -r /etc/profile /etc/profile.d/ /etc/bash.bashrc ~/.profile ~/.bashrc /etc/environment
grep MAIL -r /etc/profile /etc/profile.d/ /etc/bash.bashrc ~/.profile ~/.bashrc /etc/environment
Conversely, on my laptop running Arch, /etc/profile.d/locale.sh
appears to set LANG
, and ~/.profile
specifies LANGUAGE
. However, I could find no mention of MAIL
.
How can I find where these environmental variables are set?
EDIT
I searched the whole of /etc
and ~
for these strings in the working system (Raspbian).
grep "\bMAIL=" -r /etc 2>/dev/null
grep "\bMAIL=" -r ~ 2>/dev/null
Searching for MAIL gave no hits.
grep "\bLANG=" -r /etc 2>/dev/null
grep "\bLANG=" -r ~ 2>/dev/null
This strategy gave only a few hits for LANG in /etc
, and none for LANGUAGE. There were a few false hits in /etc
with LANG=C
, and one true hit (as mentioned by vinc17) at /etc/default/locale:LANG=en_AU.UTF-8
. However (as per a previous question by me), this file at /etc/default/locale
is not sourced on my Raspbmc machine, so I presume that the situation is a bit more complicated than the mere presence of this file.
grep "\bLANG=" -r /etc 2>/dev/null
orfind /etc -type f -exec grep "\bLANG=" {} + 2>/dev/null
/etc
directory. Under Debian, locales are set in/etc/default/locale
.~/.bash_profile
and~/.bash_login
.