1#!/bin/sh 2 3es=1 4if [ $# -eq 0 ] ; then 5 exec tr -d '\015\032' 6elif [ ! -f "$1" ] ; then 7 echo "Not found: $1" 1>&2 8else 9 for f in "$@" ; do 10 if tr -d '\015\032' < "$f" > "$f.tmp" ; then 11 if cmp "$f" "$f.tmp" > /dev/null ; then 12 rm -f "$f.tmp" 13 else 14 touch -r "$f" "$f.tmp" 15 if mv "$f" "$f.bak" ; then 16 if mv "$f.tmp" "$f" ; then 17 rm -f "$f.bak" 18 es=$? 19 echo " converted $f" 20 else 21 rm -f "$f.tmp" 22 fi 23 else 24 rm -f "$f.tmp" 25 fi 26 fi 27 else 28 rm -f "$f.tmp" 29 fi 30 done 31fi 32 33exit $es 34