該篇為Unix下進行dos轉unix格式的Unix shell。
1,單個檔案
dos2unix [srcFile] > [targetFile]
eg.
dos2unix Reporter.java > Reporter.java.back
dos2unix -437 Reporter.java Reporter.java
2, 批量檔案
#!/bin/sh
filelist=`find . -name '
*.java'`
for filename in $filelist
do
dos2unix -437 $filename $filename
echo 'convert '$filename
done
echo 'Finished!'
Thanks for Kevin and xiao si's help!