home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume13 / dominion / part26 / addnews.sh next >
Linux/UNIX/POSIX Shell Script  |  1992-02-11  |  2KB  |  71 lines

  1. #!/bin/sh
  2. #
  3. # Copyright (C) 1990 Free Software Foundation, Inc.
  4. # Written by the SBW project.
  5. #
  6. # This file is part of SBW.
  7. #
  8. # SBW is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License as published
  10. # by the Free Software Foundation; either version 1, or (at your option)
  11. # any later version.
  12. #
  13. # This software is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this software; see the file COPYING.  If not, write to
  20. # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21. #
  22.  
  23. case $# in 
  24. 2)
  25.     echo 'Adding  newsgroups' ;;
  26. *)
  27.     echo 'Problem in calling addnews' 1>&2 ; exit 2;;
  28. esac
  29.  
  30. DIR=$1
  31. DB=$2
  32. if  test ! -d "$DIR"
  33. then
  34.     echo 'Problem with news directory argument' 1>&2
  35.     exit 3
  36. fi
  37. if test ! -f  "$DIR/$DB"
  38. then
  39.     touch $DIR/$DB
  40.     echo 'Creating new database ' $DIR/$DB
  41. else
  42.     echo 'Adding groups to database ' $DIR/$DB
  43. fi
  44.  
  45. t="y"
  46. while test "$t" = "y"
  47. do
  48.     echo 'Enter the name of the news group: \c'
  49.     read group
  50.     echo 'Do you want it human (default) or just game postable (G=game) \c'
  51.     read postable
  52.     if test "$postable" = "G"
  53.     then
  54.         echo $group ' 1 0 0' >> $DIR/$DB
  55.     else
  56.         echo $group ' 1 0 1' >> $DIR/$DB
  57.     fi
  58.     if test ! -d "$DIR/$group"
  59.     then
  60.         mkdir $DIR/$group
  61.     fi
  62.     echo 'Do you want another group? (y/Y=yes) \c'
  63.     read t
  64.     if test "$t" = "Y"
  65.     then
  66.         t="y"
  67.     fi
  68. done
  69.  
  70. exit 0
  71.