convert.sh 464 B

123456789101112
  1. #!/bin/bash
  2. if [ $1 == "linux" ]; then
  3. find $2 -type f -name "*.h" -print -o -name "*.c" -print | xargs -i sed -i '1 s/^\xef\xbb\xbf//' {}
  4. echo "Convert source files to Unix format!!!"
  5. elif [ $1 == "windows" ]; then
  6. find $2 -type f -name "*.h" -print -o -name "*.c" -print | xargs -i sed -i '1 s/^/\xef\xbb\xbf&/' {}
  7. echo "Convert source files to Windows format!!!"
  8. else
  9. echo "Invaild argument!"
  10. echo "Please choose windows or linux !!!"
  11. fi