#!/bin/rc # wttr - fetch the weather # usage: wttr [-p] [location] # from weather(1) - by Fulton Brown - MIT Licence rfork e DEFAULT='Berkeley+Heights' p='no' fn usage{ echo 'usage: wttr [-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'?m&format=%25t%20%25C' if not hget http://wttr.in/~$arg.png | page echo