在 /etc/X11/Xsession.d/55gnome-session_gnomerc 中添加
echo "if [ -f /etc/profile ]; then
. /etc/profile
fi" >> /etc/X11/Xsession.d/55gnome-session_gnomerc
在 ~/.gnomerc 中添加内容:
echo "if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
export G_FILENAME_ENCODING=GBK
export G_BROKEN_FILENAMES=1" >> ~/.gnomerc
这样一来,无论系统是启动到Text Mode还是直接进入X,系统的环境变量都只需要在 /etc/profile 等文件中设置就可以了。