[colug-432] Command-line Snow Emergency Level
Rob Funk
rfunk at funknet.net
Wed Feb 18 10:32:10 EST 2015
In case you need a command to quickly get the current Franklin County
snow emergency level:
#!/bin/sh
# Franklin County Snow Emergency Level
#
# Required commands:
# curl
# xpath (from libxml-xpath-perl package)
# html2, 2xml (both from xml2 package)
tmpfile="/tmp/snow-$$.xhtml"
url=https://sheriff.franklincountyohio.gov/info/snow-emergency-levels.cfm
xhtml_cleanup() {
html2 | 2xml
}
##
curl -s "$url" | xhtml_cleanup > "$tmpfile"
status=$?
if [ $status -gt 0 ]; then
rm -f "$tmpfile"
exit $status
fi
xpath -q -e "//div[@class='main']/div//text()" "$tmpfile"
rm "$tmpfile"
#################################################################
Those two package names are on Ubuntu. YMMV.
Sending you a message when this changes, or handling other counties,
are left as an exercise for the reader.
More information about the colug-432
mailing list