fedora、redhat默認系統語言的修改方法
一、在shell下,執行export:
...
declare -x LANG="en_US"
...
這個LANE環境變量,就是我們希望去修改的,但是在哪裡修改,比較合適呢?
二、使用man bash:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
即bash在登錄時,會依次讀取這些配置文件:
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
三、對於shell的默認語言,應該在系統級的文件中(/etc/profile)修改,以便修改的結果可以被每一個用戶繼承:
打開/etc/profile,直接在其上,找不到關於LANG變量的設置命令,但細心觀察,該腳本還執行了其他腳本:
...
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
...
四、到/etc/profile.d/目錄下,查看這些*.sh的腳本,發現了一個名為"lang.sh"的文件,應該就是它了:
打開/etc/profile.d/lang.sh,開頭幾句:
...
for langfile in /etc/sysconfig/i18n $HOME/.i18n ; do
[ -f $langfile ] && . $langfile && sourced=1
done
...
這個/etc/sysconfig/i18n,就是設置系統默認語言的地方,對於我的系統,現在它的內容如下:
LANG="en_US"
SUPPORTED="en_US:en"
SYSFONT="lat0-sun16"
SYSFONTACM="iso01"
如果,你希望系統的默認語言變更為UTF-8,可以把LANG修改為:
LANG="en_US.UTF-8"