Re: Thanks for a smooth 2.6 to 2.8 transistion
On Tue, Dec 14, 2004 at 09:36:30PM +0100, Sven Luther wrote:
> > What about sites that have hundreds of users? Adding everyone to
> > the plugdev group would be somewhat unwieldy. (I'm not griping, I'm
> > just interested in a solution.) Is there an alternative to this?
>
> for user in `ls /home | grep -v lost+found`; do adduser $user
> plugdev; done
I don't mean to be picky, but...
#!/usr/bin/perl
use strict;
use warnings;
my ($first, $last);
open CONF, "</etc/adduser.conf" or die;
while (<CONF>)
{
next unless /^(FIRST|LAST)_UID=(\d+)/;
$1 eq "FIRST" and $first=$2;
$1 eq "LAST" and $last=$2;
}
close CONF;
die unless defined($first) and defined($last);
while (my ($name,undef,$uid,undef)=getpwent())
{
if ($uid >= $first and $uid <= $last)
{
print $name, "\n";
}
}
If it breaks, you get to keep as many pieces as you want.
--
Marcelo
Reply to: