#!/bin/ksh
#
# $Revision: 1.5 $ $Date: 2012-07-26 17:11:47-04 $
# $Source: /home/vogelke/bin/RCS/g,v $
# $Host: sys7.com $
# $UUID: 0d1ad8a8-0ad6-358f-8a97-b2a0c3a24d56 $
#
#<g: print the groups for one or more users
PATH=/usr/local/bin:/bin:/usr/bin; export PATH

case "$#" in
    0) set $LOGNAME ;;
    *) set X $(( for name; do grep -i $name /etc/passwd; done ) |
              cut -f1 -d: | sort -u) ; shift ;;
esac

case "$#" in
    0) echo "Sorry, could not find any of those names"; exit 1 ;;
    *) exec groups $@ ;;
esac
exit 1
