Group Permission
Carl Parrish
plug-discuss@lists.plug.phoenix.az.us
Fri, 12 Jul 2002 18:57:57 -0400
Thanks Thurman that ROCKS!!!
Carl P.
============================================================
From: "G.D.Thurman" <gthurman@csnet.sc.maricopa.edu>
Date: 2002/07/12 Fri PM 04:38:02 EDT
To: <plug-discuss@lists.plug.phoenix.az.us>
Subject: Re: Group Permission
On Thu, 11 Jul 2002, Carl Parrish wrote:
> How do you add a group into a group in the /etc/group file??
>
The following AWK script passed minimal unit testing.
# filename: groupmerge.awk
#
# To merge group b into group a...
# awk -f groupmerge.awk /etc/group a b
#
# caveats: magic #s used; no error handling
BEGIN {
if (4 != ARGC) {
printf("Usage: awk -f groupmerge.awk group_file to_group from_group\n");
printf("Example: awk -f groupmerge.awk /etc/group techies cvs");
exit 1;
}
to=ARGV[2];
from=ARGV[3];
ARGC=2;
FS=":";
}
$1 == to {
d=sprintf("%s:%s:%s:", $1, $2, $3);
s=$4;
next;
}
{ printf("%s:%s:%s:%s\n", $1, $2, $3, $4); }
$1 == from {
g=$4;
}
END {
printf("%s%s", d, s);
split(g, groups, ",");
for (i in groups)
if (!match(s, groups[i])) # avoid dups
printf(",%s", groups[i]);
printf("\n");
}
________________________________________________
See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
============================================================