pepoとネットワークを語ろう

40年前からこれまでとこれからのネットワークを語る

X-Windowsを使わないが文字化けはいや

2009-03-04 15:27:31 | Linux
ログインプロンプトからログイン後LANG=Cを忘れた時に文字化けの経験が無いだろうか?
[root@~]# cat date
2009?? 3?? 16?? ?? ?? ?? 15:12:32 JST2009?? 3?? 16?? ?? ?? ?? 15:12:32 JST
/etc/profileをこんな風にするとOK
[root@~]# cat /etc/profile
#!/bin/bash
export USER=`whoami`
export MAIL="/var/spool/mail/$USER"
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/etc
TERM=linux
if [ ! $USER = "root" ] ;then
HISTFILE=/home/$USER/.bash_history
elif [ $USER = "root" ] ;then
HISTFILE=/root/.bash_history
fi

HISTSIZE=500
#which, LANG C or ja_JP.utf8
TTY=` set| grep pts| wc -l`
if [ $TTY == "0" ];then
LANG=C
else
LANG=ja_JP.utf8
fi
PS1="[u@W]$ "
export HISTFILE
export HISTFILESIZE
export HISTSIZE
export PS1
export LANG
clear
alias ll='ls -l'
stty sane
stty erase ^?
#if [ -f /etc/WELCOME ]; then
#cat /etc/WELCOME
#fi