UNIX: DOS To UNIX

Features:
1. Convert window format to UNIX format
2. Keep the last modify date of file unchanged

if [ $# -ne 1 ];then
   echo
   echo "USAGE: $0 fileName"
   echo
   exit -1
fi
file=$1
tr -d '\r' <$file >$file.tmp
touch -r $file $file.tmp
mv $file.tmp $file
chmod 777 $file

你可能感兴趣的:(unix,dos)