home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3337 / cfdiff.sh next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1991-05-17  |  523 b   |  34 lines

  1. #!/bin/sh
  2. # Bruce Barnett
  3. # usage:
  4. # cfdiff file1.cf file2.cf
  5. # this removes all comments from the cf file
  6. case  $#  in
  7.     0|1)
  8.     echo usage: cfdiff file1 file2;
  9.     exit 1
  10.     ;;
  11. esac
  12. [ ! -f $1 ] && {
  13.     echo file $1 does not exist;
  14.     exit 1;
  15. };
  16. [ ! -f $2 ] && {
  17.     echo file $2 does not exist;
  18.     exit 1;
  19. }
  20. # if SunOS, use the -b -w option
  21. DIFF="diff -b"
  22. ARG1=`basename $1`
  23. ARG2=`basename $2`
  24. [ $ARG1 = $ARG2 ] && {
  25.     ARG2=$ARG2-
  26. }
  27. cfstrip <$1>/tmp/$ARG1
  28. cfstrip <$2>/tmp/$ARG2
  29.  
  30. cd /tmp
  31. ${DIFF} $ARG1 $ARG2
  32.  
  33. /bin/rm /tmp/$ARG1 /tmp/$ARG2
  34.