Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script issue for AIX 1

Status
Not open for further replies.

gatetec

MIS
Joined
Mar 22, 2007
Messages
420
Location
US
This script (for getting login info of each user) worked fine in AIX 5.2, but returns nothing in AIX 5.3.
What could be wrong with this?

thx much

#!/usr/bin/perl
open (PASSWD,"/etc/passwd") or die "Cannot open /etc/passwd: $!\n";
while (<PASSWD>) {
($user,undef,$uid,undef,$name,undef)=split ":";
if ($uid > 203 and $uid < 1000) {
if ($name eq "") { $name = "Unknown"; }
$last = `lsuser -a time_last_login $user`;
if ($last !~ /time_last_login/) {
$date="Unknown";
$otime="";
$time=0;
} else {
(undef,$time)=split("=",$last);
($seconds,$minutes,$hours,$day,$month,$year,undef) = localtime($time);
$month += 1;
$year += 1900;
$date="$month/$day/$year";
$otime="$hours:$minutes:$seconds";
}
write;
}
}

format =
@<<<<<<<<<< @<<<<<<< @>>> @<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<
$time, $user, $uid,$name, $date, $otime
 
what happens when you run the above script?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
yup!

chmod is not correct.

thx much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top