home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 18.ddi / reloc.2 / $INTFBIN / addgrp < prev    next >
Encoding:
Text File  |  1990-12-08  |  1.3 KB  |  50 lines

  1. #!/sbin/sh
  2. #    Copyright (c) 1990 UNIX System Laboratories, Inc.
  3. #    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T
  4. #      All Rights Reserved
  5.  
  6. #    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF
  7. #    UNIX System Laboratories, Inc.
  8. #    The copyright notice above does not evidence any
  9. #    actual or intended publication of such source code.
  10.  
  11.  
  12.  
  13. #ident    "@(#)/usr/sadm/sysadm/bin/addgrp.sl 1.1 4.0 12/08/90 43355 AT&T-USL"
  14.  
  15. ################################################################################
  16. #    Command Name: addgrp
  17. #
  18. #    Description: This scripts does 3 things:
  19. #            1) adds group to the system
  20. #                 2) changes primary group for specified logins
  21. #            3) adds supplementary group status to specified logins.
  22. #
  23. #     Inputs:        $1 - Group name
  24. #             $2 - group ID
  25. #             $3 - primary grou(s)
  26. #             $4 - supplementary grou(s)
  27. ################################################################################
  28.  
  29. NOADD=1
  30. BADPRIM=2
  31. BADSUP=3
  32.  
  33. # add group to system
  34. groupadd -g $2 $1 2> /tmp/gadderr || exit $NOADD
  35.  
  36. # change primary group for specified logins
  37. if [ $3 ]
  38. then
  39.     for x in `echo $3 | sed 's/,/ /g'`
  40.     do
  41.         usermod -g "$1" "$x" > /dev/null 2>> /tmp/gadderr
  42.     done || exit $BADPRIM
  43. fi
  44.  
  45. # add supplementary group members
  46. if [ $4 ]
  47. then
  48.     addgrpmem -g $1 `echo $4 | sed 's/,/ /g'` > /dev/null 2>&1 || $BADSUP
  49. fi
  50.