Random Project

Patch for trimming interface line

When you have longer interface names (eg. vboxnet0) the result always was 0Kb/s because @splitinterface first item was empty.

— check_networkusage.pl.20111106a 2011-11-06 11:04:22.000000000 +0100
+++ check_networkusage.pl 2011-11-06 11:07:32.000000000 +0100
@@ -61,6 +61,7 @@
while (){
$completestring = $_ if ($_=~ /$opt_I/);
@splitinterface = split(/:/,$completestring,2);
+ @splitinterface[1] =~ s/^s+|s+$//g;
@dataset_in = split(/s+/,@splitinterface [1]);
$new_in_bytes = @dataset_in[0];
@dataset_out = split(/s+/,@splitinterface [1]);