Not specifically answering your question, but be aware that Perl has a number of built-in functions relating to users and groups, for example: getlogin, getpwnam, getgrent. See Perl functions for fetching user and group info.
And it is usually preferable to use the Perl builtin function rather than an external command (for why, see Unix shell versus Perl).
Though I am not aware of a Perl builtin function that can add a Unix group, you could use them to help you verify the changes you make. To illustrate, the test program below prints all groups on the system along with which users are in each group:
use strict; use warnings; my $user = getlogin(); my ($uid, $primarygid, $home, $shell) = (getpwnam($user))[2,3,7,8]; defined($uid) or die "$0: error user '$user' does not exist\n"; print "user='$user' primary gid=$primarygid\n\n"; while (my ($name, $pw, $gid, $members) = getgrent) { print "gid : $gid\n"; print "group name : $name\n"; print "members : $members\n\n"; } endgrent();
In reply to Re: adding a group to the Unix System
by eyepopslikeamosquito
in thread adding a group to the Unix System
by deyaneria
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |