<div dir="ltr"><div>This is a cool little script but for anyone running Debian 8.0 there is a change to the xpath command. The '-q' argument fails to work. I have to use this argument structure.</div><div><br></div><div>xpath "$tmpfile" "//div[@class='main']/div//text()"<br></div><div><div><br></div><div><br></div><div>Usage:</div><div>/home/mike/perl5/bin/xpath [filename] query</div><div><br></div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 10:32 AM, Rob Funk <span dir="ltr"><<a href="mailto:rfunk@funknet.net" target="_blank">rfunk@funknet.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In case you need a command to quickly get the current Franklin County<br>
snow emergency level:<br>
<br>
<br>
#!/bin/sh<br>
# Franklin County Snow Emergency Level<br>
#<br>
# Required commands:<br>
# curl<br>
# xpath (from libxml-xpath-perl package)<br>
# html2, 2xml (both from xml2 package)<br>
<br>
tmpfile="/tmp/snow-$$.xhtml"<br>
url=<a href="https://sheriff.franklincountyohio.gov/info/snow-emergency-levels.cfm" target="_blank">https://sheriff.franklincountyohio.gov/info/snow-emergency-levels.cfm</a><br>
<br>
xhtml_cleanup() {<br>
html2 | 2xml<br>
}<br>
<br>
##<br>
<br>
curl -s "$url" | xhtml_cleanup > "$tmpfile"<br>
status=$?<br>
if [ $status -gt 0 ]; then<br>
rm -f "$tmpfile"<br>
exit $status<br>
fi<br>
<br>
xpath -q -e "//div[@class='main']/div//text()" "$tmpfile"<br>
<br>
rm "$tmpfile"<br>
<br>
#################################################################<br>
<br>
Those two package names are on Ubuntu. YMMV.<br>
<br>
Sending you a message when this changes, or handling other counties,<br>
are left as an exercise for the reader.<br>
<br>
<br>
_______________________________________________<br>
colug-432 mailing list<br>
<a href="mailto:colug-432@colug.net">colug-432@colug.net</a><br>
<a href="http://lists.colug.net/mailman/listinfo/colug-432" target="_blank">http://lists.colug.net/mailman/listinfo/colug-432</a><br>
</blockquote></div><br></div>