#!/bin/sh 02 03 until [ -z $1 ]; do 04 dos2unix $1 2>/dev/null 05 iconv -f GBK -t UTF-8 $1 -o /tmp/win2unix.tmp 2>/dev/null 06 07 if [ $? -eq 0 ]; then 08 mv /tmp/win2unix.tmp $1 09 echo "win2linux: converting file $1 to UNIX format ..." 10 else 11 rm -rf /tmp/win2unix.tmp 12 echo "win2linux: converting file $1 is not WIN format ..." 13 fi 14 15 shift 16 done [代码] linux2win 01 #!/bin/sh 02 03 until [ -z $1 ]; do 04 unix2dos $1 2>/dev/null 05 iconv -f UTF-8 -t GBK $1 -o /tmp/unix2doc.tmp 2>/dev/null 06 07 if [ $? -eq 0 ]; then 08 mv /tmp/unix2doc.tmp $1 09 echo "linux2win: converting file $1 to WIN format ..." 10 else 11 rm -rf /tmp/unix2doc.tmp 12 echo "linux2win: converting file $1 is not Linux format ..." 13 fi 14 15 shift 16 done