Next Program Repair Shop 134

Unnecessary Shell Calls

     Subject: get idle times and format it
     Date: Fri, 14 Dec 2001 03:55:10 +0100
     $line = `top b -n 0 | awk '/idle/ {gsub ("%", "") ; print $3,$5,$7,$9}'`;
     @data = split(/ /, $line);
     $user     = $data[1];
     $system = $data[2];
     $nice     = $data[3];
     $idle      = $data[4]
     ($line) = grep /idle/, `top b -n 0`;
     ($user, $system, $nice, $idle) = ($line =~ m/\d+\.\d+/g);


Next Copyright © 2002 M. J. Dominus