dos2unix 388 B

12345678910111213141516
  1. #!/bin/sh
  2. if [ "$1" = "-h" ] || [ "$1" = "" ]; then
  3. printf "\n\tUsage : `basename $0` {files}\n"
  4. printf "\n\t- Convert text file from DOS format to ISO format\n\n"
  5. else
  6. for i in $*; do
  7. if [ -f $i ]; then
  8. tr -d "\r" < $i > /tmp/cr2lf.$$
  9. cat /tmp/cr2lf.$$ > $i # retains permissions.
  10. rm /tmp/cr2lf.$$
  11. else
  12. echo $0": " $i "does not exist." >&2
  13. fi
  14. done
  15. fi