# # This program gets the slashdot.xml from slashdot.org # and extracts the and <url> elements from each # of the <story> elements stored in the dot-xml file. # It dynamically generates a webpage that displays the # titles as hyperlinks to Slashdot articles. # # The dynamically generated dot-html file is installed # in the MOTD directory. # # The following cron entry is used to generate the # webpage once an hour. # # 15 * * * * /home/gdt/bin/gdtdot # or # @hourly /home/gdt/bin/gdtdot # home_dir="/home/gdt" tmp_dir="$home_dir/tmp" motd_dir="$home_dir/public_html/motd" xmlfname="slashdot.xml" cd $tmp_dir /usr/bin/lynx -source http://slashdot.org/$xmlfname|gunzip >$xmlfname tfname="slash.title" ufname="slash.urls" rm -f $tfname $ufname tag="title" grep "<$tag>" $xmlfname | \ sed -e "s/<$tag>//g" -e "s/<\/$tag>/<\/a>/g" >$tfname tag="url" grep "<$tag>" $xmlfname | \ sed -e "s/<$tag>/\<a href=\"/g" \ -e "s/<\/$tag>/\"><br \/>/g" >$ufname h="slash.html" rm -f $h t="GDT::Dot::Headlines from Slashdot" cat <<HERE_DOCUMENT >$h <html> <head> <title>$t

$t

Thank You to Slashdot.org for making their slashdot.xml file available for free.
HERE_DOCUMENT paste $ufname $tfname >>$h rm -f $ufname $tfname cat <<@ >>$h
Slashdot random story generator.
generated: `date`
the code: GDT::Dot::Slashdot @ chmod 644 $h mv -f $h $motd_dir/GDTDot.html exit 0