#!/bin/sh
#
# Check whether the "$1" group exists, and create it if it doesn't.
#

group=$1
grpfile=/etc/group

if grep -q "^${group}:" $grpfile; then exit 0; fi

num=$[1+`cut -d : -f 3 $grpfile | sort -n | tail -n 1`]

line="${group}:*:$num:root"

echo Adding line to $grpfile: "$line"

echo "$line" >> $grpfile

# EOF
