Date: Mon, 21 Jan 2002 21:28:23 -0600 From: jacks@sage-american.com To: freebsd-questions@freebsd.org Subject: Perl5 Script Debug Help Message-ID: <3.0.5.32.20020121212823.01831ca0@mail.sage-american.com>
next in thread | raw e-mail | index | archive | help
I have a script that under BSDi does a neat summary of users. I wonder if anyone will take a look to see how this script may be adapted to run on FBSD 4.4-stable. It doesn't get very far & dies at line 4 for starters, which is: my($pwdfile) = (getpwuid($>))[7] . '/etc/passwd'; Not a very good start I know, so don't know how many more things need tweaking. **************************************************************************** **************** #!/usr/bin/perl5 my(@pwent,$ftppriv,$homedir,$quota); my($pwdfile) = (getpwuid($>))[7] . '/etc/passwd'; open (PWDFILE, $pwdfile) or die('Could not open password file'); print <<'HEAD'; UserName FullName FTP Home Directory Quota E-mail Quota ---------------- ------------------------- ------------------------------ ----- ------------ HEAD $~ = 'STDOUT'; while (@pwent = split(/:/,<PWDFILE>)) { chomp $pwent[6]; @junk = split(/\|/, $pwent[6]); #print "[", $pwent[6], "] ", "<", scalar(@junk), "> ", "{", $junk[0], "} {", $junk[1], "}\n"; ($ftppriv,$quota) = split(/,/,$junk[0]); if (!defined $junk[1]) { $email_quota = "none"; }elsif ($junk[1] =~ /mail,(\d+)/) { $email_quota = $1 . " megs"; } elsif ($junk[1] =~ /mail/) { $email_quota = "unlimited"; } if ($ftppriv ne 'ftp') { $homedir = '(No FTP Privileges)'; } else { $homedir = $pwent[5]; } if (!$quota =~ /^\d+$/) { $quota = 'none'; } write; } format STDOUT = @<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<< @<<<<<<<<< $pwent[0] , $pwent[4] , $homedir , $quota, $email_quota . Best regards, Jack L. Stone, Server Admin =================================================== Sage-American http://www.sage-american.com jacks@sage-american.com "My center is giving way, my right is in retreat; ....situation excellent! ....I shall attack!" =================================================== To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.5.32.20020121212823.01831ca0>