blob: b7611a4faa8dca6de266ab2d67b334c06624f1e3 (
plain)
- #!/usr/bin/perl
- ($newgroup, @ARGV) = @ARGV;
- if ($newgroup eq "")
- {
- print "Syntax: usergroupadd newgroup PATTERN\|*\n";
- exit;
- }
- @input = "| grep -i \"@ARGV\"" if @ARGV;
- @users = `cat /etc/passwd @input`;
- print "Users modified: ";
- foreach $n (@users)
- {
- $user =~ /(\S+)/;
- ($a, $b, $c, $d, $name) = split (/:/, $n);
- # ($name) = split(/,/,$name);
- next if ($c < 100);
- # $output = "";
- # @id = split /\s/, `id -Gn $a`;
- # foreach $o (@id)
- # {
- # $output .= "$o,";
- # }
- # $output .= "$newgroup";
- #
- # `usermod -G $output $a`;
- `adduser $a $newgroup`;
- print "$a";
- # print "($output)";
- print ", ";
- }
- print "Done!\n";
|