weather script

This commit is contained in:
Fulton Browne 2021-04-03 19:54:45 +00:00
parent 5965d10efb
commit 4af3a5b887
1 changed files with 34 additions and 0 deletions

34
util/weather Executable file
View File

@ -0,0 +1,34 @@
#!/bin/rc
rfork e
DEFAULT=ewr
p = 'no'
fn usage{
echo 'usage: weather [-p] [location]' >[1=2]
exit usage
}
while (~ $1 -*){
switch($1){
case '-p'
p='yes'
shift
case *
usage
}
}
switch($#*){
case 0
arg=$DEFAULT
if(~ $#weather 1)
arg=$weather
case 1
arg=$1
case *
usage
}
if (~ $p 'no') hget 'http://wttr.in/'$arg'?format=%25t%20%25C'
if not hget http://wttr.in/~$arg.png | page
echo