Might I trouble you kind folks for a bit of feedback? This is
my first real script I put together in which it collects all 
users from the output of the 'repquota -a' command who have not
yet had quotas applied. It does work. I'm just curious if it's
an eye sore. Maybe I should just give up attempting this whole
programming stuff and stick to wielding my light sabre at those
selfless stormtroopers (who come in the hundreds) til the wee
hours of the morning?

- Bill

## start

#!/usr/bin/perl -w

system("/usr/bin/clear");
@arg1 = qw(
      mail
      sysquota
      root
      nobody
      smmsp
      daemon
      testing
);

unless (open(RQUOTA,"/usr/sbin/repquota -a |"))  {
       print("Unable to open repquota file:\n");
} else {
       if (-e "/tmp/stat.tmp") {
          unlink("/tmp/stat.tmp");
       }
       print("Users Without Quotas * * * *\n\n");
       while (<RQUOTA>)  {
             if (/\s0\s{7}0\s{1,}/) {
                for ( $i = 0; $i <=6; $i++ )  {
                      s/\b$arg1[$i]\b\s{0,}\-\-\s{0,}[0-9]{1,}.*$//g;
                }
                if (/^[a-zA-Z0-9]/)  {
                   print("$_");
                }
                if (/(\w+)/)  {
                   unless (open(NQUOTA,">>/tmp/stat.tmp"))  {
                          print("Unable to open /tmp/stat.tmp file:\n");
                   } else {
                          print(NQUOTA "$1\n");
                   }
                }
             }
       }

       print("\n");
       close(NQUOTA);
       close(RQUOTA);
}

### end 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to