mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-16 15:11:52 +00:00
rmgroup - delete a Unix group
usage: rmgroup group
This commit is contained in:
parent
874f1e42a7
commit
eb651d9f73
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19267
29
usr.sbin/adduser/rmgroup.sh
Normal file
29
usr.sbin/adduser/rmgroup.sh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user