freebsd-src/usr.sbin/adduser/rmgroup.sh
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00

30 lines
676 B
Bash

#!/bin/sh
# Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
# All rights reserved.
#
# rmgroup - delete a Unix group
#
# $FreeBSD$
PATH=/bin:/usr/bin; export PATH
db=/etc/group
case "$1" in
""|-*) echo "usage: rmgroup group"; exit 1;;
wheel|daemon|kmem|sys|tty|operator|bin|nogroup|nobody)
echo "Do not remove system group: $1"; exit 2;;
*) group="$1";;
esac
if egrep -q -- "^$group:" $db; then
if egrep -q -- "^$group:\*:0:" $db; then
echo "Do not remove group with gid 0: $group"
exit 2
fi
egrep -v -- "^$group:" $db > $db.new &&
cp -pf $db $db.bak &&
mv -f $db.new $db
else
echo "Group \"$group\" does not exists in $db."; exit 1
fi