#!/usr/bin/perl -w # # Script which produces a list of non-expired user accounts. # Written 4 Aug 02 by M. Dickerson. use strict; #my $name; my $pwd; my $uid; my $gid; my $quota; #my $comment; my $gecos; my $dir; my $shell; # Note that FreeBSD returns the expiration time in a 10th field which # is unknown to Perl my $MIN_UID = 1000; # adjust as appropriate for your system my $MAX_UID = 9999; my $x; my $exp; my $name; my $uid; my $now = time; #while (my @list = getpwent) { print join(":", @list), "\n";} #exit 0; while (($name, $x, $uid, $x, $x, $x, $x, $x, $x, $exp) = getpwent) { next if ($uid < $MIN_UID || $uid > $MAX_UID); next if ($exp > 0 && $exp < $now); print STDERR "$name: no expiration date\n" if ($exp == 0); print "$name\n"; }