19 lines
617 B
Bash
Executable File
19 lines
617 B
Bash
Executable File
#! /usr/bin/perl -w
|
|
use strict;
|
|
use warnings;
|
|
use JSON;
|
|
|
|
my $city = $ARGV[0] or scalar("bluffdale");
|
|
|
|
my $info = `curl -sm 5 wttr.in/$city?format=j1` or die "Error";
|
|
|
|
my $json = decode_json $info or die "Error";
|
|
|
|
my $loc = %{$json}{"nearest_area"}->[0]->{"areaName"}->[0]->{"value"};
|
|
my $temp = %{$json}{"current_condition"}->[0]->{"temp_F"};
|
|
my $windS = %{$json}{"current_condition"}->[0]->{"windspeedMiles"};
|
|
my $windD = %{$json}{"current_condition"}->[0]->{"winddirDegree"};
|
|
my $desc = %{$json}{"current_condition"}->[0]->{"weatherDesc"}->[0]->{"value"};
|
|
|
|
print $desc.":".$temp.":".$windS.":".$windD.":(WT)".$loc;
|