home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 18.ddi / reloc.2 / $INTFBIN / chk_pgrp < prev    next >
Encoding:
Text File  |  1990-12-08  |  1.1 KB  |  37 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/chk_pgrp.sl 1.1 4.0 12/08/90 37189 AT&T-USL"
  14.  
  15. ################################################################################
  16. #    Command Name: chk_pgrp
  17. #
  18. #     This functions is used for validating the Primary Group
  19. ################################################################################
  20.  
  21. NOTHING=1    # Nothing entered
  22. NOTUNIQ=2    # Not unique
  23. OK=0        # login name (ID) is valid
  24.  
  25. test -z "$1" && exit $NOTHING
  26.  
  27. DEF_GRPNAM=
  28. DEF_GRPID=
  29.  
  30. test "$1" = "$DEF_GRPNAM" || test "$1" = "$DEF_GRPID" && exit $OK
  31.  
  32. sed -e 's/^\([^:]*\):[^:]*:\([^:]*\).*/\1,\2/p' \
  33. -e '/,[0-9]\{1,2\}$/d' /etc/group | grep "^$1," > /dev/null ||
  34.  
  35. sed -e 's/^\([^:]*\):[^:]*:\([^:]*\).*/\1,\2/p' \
  36. -e '/,[0-9]\{1,2\}$/d' /etc/group | grep ",$1$" > /dev/null && exit $OK || exit 1
  37.