This week's Monday Linux/Unix bash shell script is another chapter in our book "Never ever leaving the CLI ever" ;) Previous entries you may be interested in include our posts on Accessing the International Dictionary, checking out the world's weather, spewing out famous quotations on pretty much any subject, doing encyclopedia lookups, accessing the online Thesaurus, translating between different languages and, of course, using the online dictionary.
This script gets its content from The Original Farmer's Almanac Site and is actually easier to use because it accepts no arguments. We didn't do this to be cruel, but if you check out the Official Site, you'll see that specific-day access isn't readily available (only "Red Letter Days"). If I'm wrong, just let me know where I forgot to look and I'll be happy to update this script so that you can punch a few keys and get all your advice for any date in history (or the future) the you want. Right now, it brings up the current day's entry and you can execute it very easily, like so:
host # ./almanac.sh
Look just below for the output from my final test run on Sunday, October 12th 2008. You'll note that I included a straight up URL in the "see here for more info" part near the top . Adding the actual HTML tags looked ugly and most terminal programs, like PuTTY understand http:// and will make the line of text a hypertext link for you automatically.
Click the picture below to experience the accelerated Chia-effect ...minus the grassy hair ;)
Hope you enjoy this script, and can find some use for it.
As a special note to all readers who have taken the time to send in comments over the past 4 or 5 days, I will be getting around to actually reading my mail tomorrow. Complications have kept me from accessing my account, which are now (hopefully) resolved. If you wrote me more than once, I will probably reply to you more than once. No offense, and sorry if it's annoying ;)
Have a great Columbus Day. Hopefully your place of employment considers it worthy of a paid day off :)
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
# almanac.sh - Find out lots of interesting stuff about today :)
# 2008 - Mike Golvach - firstname.lastname@example.org
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
if [ $numargs -gt 1 ]
echo "Usage: $0"
echo "Your Farmer's Almanac Information For: $date"
echo "Visit http://www.almanac.com for answers to the riddles and more detailed information!"
$wget -nv -O - "http://www.almanac.com/" 2>&1|sed -e 's/<\/p>/\
/g' -e :a -e 's/<[^>]*>/ /g;/</N;//ba' -e s'/—/\
/g' -e s'/Today in History/\
Today In History\
/g'|sed -e '/^[ \t]*$/d' |sed -e 's/BOBISALIVE//g' -e '1,/Customized astronomical/d' -e '/Looking for information you used to find here/,$d'|sed -e 's/ Weather History Search \| More Weather \| More Advice \| Answer \| Archives \| Answer \| Archives \| Answer \| Archives \| More Gardening \| Definition \| Archives \| Archives \| More Advice //g' -e 's/^ *|*/X/' -e 's/^X//g'
Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.