home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / batch / batchcheck next >
Text File  |  1994-08-17  |  548b  |  31 lines

  1. #! /bin/sh
  2. # Check for existence of files in a batch, passing through only batchfile
  3. # entries for files that exist.  -v reverses sense of test.
  4.  
  5. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  6. . ${NEWSCONFIG-/etc/news/bin/config}
  7.  
  8. PATH=$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH ; export PATH
  9. umask $NEWSUMASK
  10.  
  11. case "$1" in
  12. -*)    opt="$1" ; shift    ;;
  13. esac
  14.  
  15. cd $NEWSARTS
  16. while read name rest
  17. do
  18.     out=n
  19.     case "$name" in
  20.     '<'*'>')    out=y    ;;
  21.     *)    if test -f "$name"
  22.         then
  23.             out=y
  24.         fi
  25.         ;;
  26.     esac
  27.     case "$out$opt" in
  28.     y|n-v)    echo "$name $rest"    ;;
  29.     esac
  30. done
  31.