From owner-freebsd-questions Mon Jan 21 19:28:49 2002 Delivered-To: freebsd-questions@freebsd.org Received: from sage-american.com (sage-american.com [216.122.141.44]) by hub.freebsd.org (Postfix) with ESMTP id 2812437B43E for ; Mon, 21 Jan 2002 19:28:26 -0800 (PST) Received: from SAGEONE (adsl-64-219-30-193.dsl.crchtx.swbell.net [64.219.30.193]) by sage-american.com (8.9.3/8.9.3) with SMTP id VAA20897 for ; Mon, 21 Jan 2002 21:28:25 -0600 (CST) Message-Id: <3.0.5.32.20020121212823.01831ca0@mail.sage-american.com> X-Sender: jacks@mail.sage-american.com X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Date: Mon, 21 Jan 2002 21:28:23 -0600 To: freebsd-questions@freebsd.org From: jacks@sage-american.com Subject: Perl5 Script Debug Help Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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(/:/,)) { 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