home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / fchk294s.zip / ftnchek-2.9.4 / test / Compare.sh < prev    next >
Text File  |  1996-10-04  |  1KB  |  41 lines

  1. #!D:/bin/os2/bin/sh.exe
  2. #
  3. # Bourne shell script to compare File in directory ./Vary with
  4. # original in directory ./Okay and print differences if any.
  5. # If no differences it echoes a dot to show progress.
  6. # If differences, touches file CHECK_FAILED
  7. #
  8. # Usage: Compare.sh Okay Vary File
  9.  
  10. OKAY=$1
  11. VARY=$2
  12. FILE=$3
  13.  
  14.     if [ ! -d ${OKAY} ] ;
  15.     then
  16.         echo "Creating directory ${OKAY}" ;
  17.         mkdir.exe ${OKAY};
  18.     fi
  19.     if [ ! -f ${OKAY}/${FILE} ] ;
  20.     then
  21.         echo "${FILE} is new" ;
  22.         cp.exe ${FILE} ${OKAY}/${FILE} ;
  23.     fi
  24.     if diff.exe ${OKAY}/${FILE} ${FILE} ;
  25.     then
  26.         rm.exe -f -f ${FILE} ;
  27.         echo '.' | gawk.exe '{printf("%s",$1);}' ;
  28.     else
  29.         touch CHECK_FAILED
  30.         echo "--------------------------------------------------" ;
  31.         echo "Differences in ${OKAY}/${FILE}  ${VARY}/${FILE} :" ;
  32.         if [ ! -d ${VARY} ] ;
  33.         then
  34.         echo "Creating directory ${VARY}" ;
  35.         mkdir.exe ${VARY} ;
  36.         fi
  37.         mv.exe ${FILE} ${VARY}/${FILE} ;
  38.         diff.exe ${OKAY}/${FILE} ${VARY}/${FILE} ;
  39.     fi
  40.     exit 0
  41.