eis/config/bin/chgcode

31 lines
868 B
Plaintext
Raw Normal View History

##################################################################
# #
# SHANGHAI BAOSIGHT CO. #
# #
# This script is create by Wei Shengyu #
# #
# 2013.03.26 #
# #
##################################################################
#!/bin/bash
if [ $# -lt 1 ]; then
echo "At least one file"
echo "useage:chgcode [FILENAME]"
fi
declare -i s
for (( i=1; i<=$#; i=i+1))
do
dos2unix ${!i}
iconv -f gb2312 -t utf8 ${!i} -o ${!i}.tmp
if [ $? -eq 0 ];then
mv ${!i}.tmp ${!i}
else
rm ${!i}.tmp
fi
done