home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / expire / dircheck next >
Text File  |  1990-03-06  |  545b  |  34 lines

  1. #! /bin/sh
  2. # dircheck -- checker for expire regression testing
  3.  
  4. case "$1" in
  5. -n)    invert=yes ; shift ;;
  6. esac
  7.  
  8. for f in `sed 's/.*    //;s:\.:/:g'`
  9. do
  10.     if test " $invert" = " "
  11.     then
  12.         if test ! -f $1/$f
  13.         then
  14.             echo "cannot find $1/$f" >&2
  15.             exit 1
  16.         fi
  17.         it="`cat $1/$f`"
  18.         if test " $it" = " $f" || expr " $it" : ".*:$f:.*" >/dev/null
  19.         then
  20.             : okay
  21.         else
  22.             echo "contents of $1/$f are wrong" >&2
  23.             exit 1
  24.         fi
  25.     else
  26.         if test -f $1/$f
  27.         then
  28.             echo "found $1/$f, shouldn't have" >&2
  29.             exit 1
  30.         fi
  31.     fi
  32. done
  33. exit 0                # for stupid shells
  34.