# Output the most recent blog entries in RSS XML format # Blog entries must be named in the format YYYYMMDD##.html # Where YYYY is between 2000 and 2999 # and ## is an ordinal of some kind # NOTE: Script breaks after Dec 31, 2999 # How many entries do you want? howmany=10 # What's the value of today's date? today=`date +%Y%m%d` # What's our file set? catalog=(`ls -r 2*.html`) # Create the file list for entry in ${catalog[@]} ; do # if it's from today or earlier, add it to the list if [ ${entry:0:8} -le ${today} ] ; then recent=(${recent[@]} ${entry}) ; fi # if the list is full, stop adding if [ ${#recent[@]} -eq $howmany ] ; then break ; fi done # Output recent entries for file in ${recent[@]} ; do echo "" grep "" $file ; echo " <link>http://www.ee0r.com/blog/"${file}"</link>" grep "<description>" $file ; grep "<pubdate>" $file ; grep "<category>" $file ; echo "</item>" echo # insert a blank line done