diff options
author | wosch <wosch@FreeBSD.org> | 1996-10-30 20:58:47 +0000 |
---|---|---|
committer | wosch <wosch@FreeBSD.org> | 1996-10-30 20:58:47 +0000 |
commit | aafdab57f3e07a14467e840e7ba559b810eaef68 (patch) | |
tree | a8599ed319ed82b1f2fea50de0e34d669dea011d /usr.sbin | |
parent | 57ea19b261682f8996fd4092b61a31c0b701a23b (diff) | |
download | FreeBSD-src-aafdab57f3e07a14467e840e7ba559b810eaef68.zip FreeBSD-src-aafdab57f3e07a14467e840e7ba559b810eaef68.tar.gz |
rmgroup - delete a Unix group
usage: rmgroup group
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/adduser/rmgroup.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/usr.sbin/adduser/rmgroup.sh b/usr.sbin/adduser/rmgroup.sh new file mode 100644 index 0000000..ad0afa4 --- /dev/null +++ b/usr.sbin/adduser/rmgroup.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Copyright (c) 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. +# All rights reserved. +# +# rmgroup - delete a Unix group +# +# $Id: rmgroup.sh,v 1.1 1996/10/30 20:41:17 wosch Exp wosch $ + +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 |