Added C to F conversion, because I don't want to change it in every script.
This commit is contained in:
parent
f46ddbd809
commit
c623d3ea45
10
weather.sh
10
weather.sh
@ -92,6 +92,10 @@ sub getdir {
|
|||||||
return "↑";
|
return "↑";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub c2f {
|
||||||
|
return ($_[0] * (9/5)) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
my @weather = split(":",checksources) or print "Not Available\n\n#FF0000" and exit 33;
|
my @weather = split(":",checksources) or print "Not Available\n\n#FF0000" and exit 33;
|
||||||
|
|
||||||
my $type = $weather[0];
|
my $type = $weather[0];
|
||||||
@ -112,9 +116,9 @@ else {$type=$type."...";}
|
|||||||
|
|
||||||
my $loc = substr(($weather[4] or "??????????"), 0, 9);
|
my $loc = substr(($weather[4] or "??????????"), 0, 9);
|
||||||
|
|
||||||
my $format = '%10.10s - %5.5s %03dC %s %03dmph';
|
my $format = '%10.10s - %5.5s %03dF %s %03dmph';
|
||||||
printf( $format, $loc, $type, $temp, $wdir, $wind);
|
printf( $format, $loc, $type, c2f($temp), $wdir, $wind);
|
||||||
print "\n";
|
print "\n";
|
||||||
printf( $format, $loc, $type, $temp, $wdir, $wind);
|
printf( $format, $loc, $type, c2f($temp), $wdir, $wind);
|
||||||
print "\n";
|
print "\n";
|
||||||
print $color."\n";
|
print $color."\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user