#!/usr/bin/perl
use warnings;
use strict;
use Term::ANSIColor;
$Term::ANSIColor::AUTORESET++; # reset color after each print
my $flag = 1;
while (1) {
open OUTPUT, "iwconfig 2>&1 |" or die print "Algo salio
mal con iwconfig\n";
system "clear";
while (<OUTPUT>) {
if (/Link Quality=(\d+)\/100/) {
$flag = 0;
print "Link Quality ";
if ($1 > 60) {
print colored("$1\n", "green");
} elsif ($1 <= 60 and $1 >= 50) {
print colored("$1\n", "yellow");
} else { print colored("$1\n", "red"); }
}
}
if ($flag == 1) {
print colored("Wifi connection lost! :\(\n", "red");
} else { $flag = 1 }
sleep 1;
}
syntax highlighted by Code2HTML, v. 0.9.1
No hay comentarios:
Publicar un comentario