dos2unix.sh 479 B

1234567891011121314151617181920212223242526
  1. #! /bin/sh -v
  2. # Convert files from DOS to Unix format
  3. # Usage:
  4. # dos2unix.sh file1 file2 ...
  5. # converts in-place
  6. #
  7. if test "$#" = "0"
  8. then
  9. echo Usage: dos2unix.sh file1 file2 ...
  10. exit 0
  11. fi
  12. for x in $@ ; do
  13. if test -d $x
  14. then
  15. echo $x is a directory in dos2unix.sh
  16. exit 0
  17. fi
  18. # BEWARE. I believe that not all versions of "tr" are compatible!
  19. tr -d "\r" < $x > /tmp/dos2unix.tmp
  20. mv /tmp/dos2unix.tmp $x
  21. if test "x$verbose" != "x"
  22. then
  23. echo File $x converted to Unix style
  24. fi
  25. done