#!/bin/ksh93
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/lib/ksh93/aix/KLIB_AIX_get_usergroup.sh 1.4 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2005,2011 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)74	1.4 src/43haes/lib/ksh93/aix/KLIB_AIX_get_usergroup.sh, hacmp, 61haes_r714 11/28/11 14:53:55
#
#=head1 NAME
#
# KLIB_AIX_get_usergroup - Obtain the group name for a user
#
#=head1 SYNOPSIS
#
# group=$(KLIB_AIX_get_usergroup "mattg")
#
#=head1 DESCRIPTION
#
# This function will echo to stdout the group name for the specified user
# the group is the parent group, not the list of groups the user belongs to
#
#=head1 ARGUMENTS
#
#   1: [scalar] user name to determine parent group (pgrp in lsuser)
#
#=head1 RETURN
#
# 	None, echos output to stdout
#
#=head1 COPYRIGHT
#
#(C) COPYRIGHT International Business Machines Corp. 2005
#All Rights Reserved
#
#=cut
#
function KLIB_AIX_get_usergroup
{
	. /usr/es/lib/ksh93/func_include
        user=$1
        group=$(lsuser -a pgrp $user)
        group=${group/*=/}
        echo $group
}
