#
#####Message Texts######
set mesg1 = "Please enter the name of the group to be added:"
set mesg2a = "Group id name "
set mesg2b = " is already taken, please select another."
set mesg3 = "Please enter a numeric group id number: "
set mesg4a = "Group id number "
set mesg4b = " is already taken, please select another."
set mesg5 = "Please enter member's logon ID's: "
########################
						# get unique group name 
echo -n $mesg1' '
scanname:
set name = ($<)
if ($#name == 0) then
	goto scanname
endif
						# tell awk what name to match
						# check name for uniqueness
awk '{FS=":"} {print $1}' /etc/group > foo
fgrep -xs $name foo
if ($status != 1) then
	echo -n $mesg2a $name $mesg2b' '
	goto scanname
endif
						# get unique group number 
echo -n $mesg3' '
scanid:
set id = ($<)
if ($#id == 0) then
	goto scanid
endif
						# tell awk what id to match
						# check id for uniqueness
awk '{FS=":"} {print $3}' /etc/group > foo
fgrep -xs $id foo
if ($status != 1) then
	echo -n $mesg4a $id $mesg4b' '
	goto scanid
endif
						# get member's names
echo $mesg5
set members = ($<)
						# append new entry to group file
echo $name':*:'$id':'$members >> /etc/group
/bin/rm foo
