In the dungeon a bored geek bent over his simmering workstation.
"Now there I add bit of XML" he thought aloud. "And few left over chunks of useless commands".
**PUFF**
hmm, what's this. Enlighten me fellows.
Cheers
--arky
#!/bin/sh # # SCRIPT: cow-words.sh # AUTHOR: Rakesh 'arky' Ambati (http://www.linuxgazette.com/blog/4864) # DATE: 17 January 2005 # VERSION: you_must_be_kidding # # CREDITS: I Thank Karma_Police for the 'cow file randomizer code' # # PURPOSE: Retrieves the Dictionary.com 'Word of the Day" RSS Feed and # a random character teaches them. # # DEPENDS: 'xmlstarlet' http://xmlstr.sourceforge.net # 'cowsay' http://www.nog.net/~tony/warez/cowsay.shtml # Both are available packages in Debian (Sid) repository. # To install them just type 'apt-get install xmlstarlet cowsay' # # # set -x # Uncomment this for debugging. # # ############################################################################## # Use 'cowsay -l' to the full list of cow files in your system # # (Sorry fellas I removed possible offensive 'sodomized*, head-in,telebears, # # kiss' cow files # ##############################################################################
cows=(apt beavis.zen bong bud-frogs bunny cheese cower daemon default dragon dragon-and-cow elephant elephant-in-snake eyes flaming-sheep ghostbusters hellokitty kitty koala kosh luke-koala mech-and-cow meow milk moofasa moose mutilated ren satanic sheep skeleton small stegosaurus stimpy supermilker surgery three-eyes turkey turtle tux udder vader vader-koala www)
random=RANDOM%44
############################################################# ## Get the XML feed and do the selection ## #############################################################
/usr/bin/xmlstarlet sel --net -t -m "/rss/channel/item/description" -v "." "http://dictionary.reference.com/wordoftheday/wotd.rss" | /usr/bin/cowsay -n -f ${cows[random]}
# End of the script