标签:style blog color 文件 2014 问题
linux下一般是采用utf-8的编码,而我们在windows上编辑文件时是gb2312的编码。所以导致中文编码会乱码。要更正这个问题实际上很简单只要把文件转换成utf-8编码格式然后再导入就ok啦。
手动更改配置文件的命令:
vi /etc/sysconfig/i18n
将LANG="zh_CN.UTF-8"修改为:LANG="zh_CN.GBK"
保存并关闭,运行下面的命令使配置生效:
source /etc/sysconfig/i18n
将终端字符编码显示为简体中文:
vi /etc/profile.d/chinese.sh
添加下面这行:export LC_ALL=zh_CN.GBK
source /etc/profile.d/chinese.sh
OK,配置完成,测试一下吧!
[root@tradx24 bin]# vi one.sh ## ====================================================## ## auth:wonter ## ## date:2014-06-12 ## ## to :one.sh ## ## ====================================================## #!/bin/sh #获取服务器列表信1m|/ ./.list.ll #执行获取文件脚本 #name list1=(`cat ../tools/list | awk ‘{print $1}‘ | sed "1,1d"`) for((i=0;i<${#list1[@]};i++)); do sh ./${list1[i]}.wy done echo " " echo "------------------------------------------------------" echo " " echo "第一步执行完毕,请执行下方提示命令,修改相关配置文件!" echo " " echo "#conf" echo " " echo "修改相关配置后,请再回到本目录下,执行 two.sh 脚本 . " echo " " echo "------------------------------------------------------"
再看看之前的乱码
## ====================================================## ## auth:wonter ## ## date:2014-06-12 ## ## to :one.sh ## ## ====================================================## #!/bin/sh #m~N1m~O~Vm~\~Mm~J1m~Y1m~H~W表信m~A/.list.ll #m~I[1m~Lm~N1m~O~Vm~V~G件m~D~Zm~\name list1=(`cat ../tools/list | awk ‘{print $1}‘ | sed "1,1d"`) for((i=0;i<${#list1[@]};i++)); do sh ./${list1[i]}.wy done echo " " echo "------------------------------------------------------" echo " " echo "第1m~@步m~I[1m~L1m~L1m~U1m~L请m~I[1m~L1m~Km~V1m~O~P示m~Q1m~L修m~T1m~[1m~E1m~E~M置m~V~G件1m~A" echo " " echo "#conf" echo " " echo "修m~T1m~[1m~E1m~E~M置m~P~N1m~L请m~F~Mm~[~^m~H1m~\1m~[[1m~U1m~K1m~Lm~I[1m~L two.sh m~D~Zm~\ " echo " " echo "------------------------------------------------------"
测试成功,分享给大家!欢迎关注分享....
关于Linux与windows传递文件乱码问题,布布扣,bubuko.com
标签:style blog color 文件 2014 问题
原文地址:http://www.cnblogs.com/Javame/p/3820208.html