#!/bin/bash echo "Content-type: text/html" echo "" xml_next () { local IFS='>' read -d '<' TAG VALUE } cat < Blog post list

Blog

EOT for post in $(ls posts | tac | grep "post$"); do echo '
' cat posts/$post | while xml_next; do if [ $TAG = "h1" ]; then echo '

'$VALUE'

' fi if [ $TAG = "p" ]; then echo '

'$VALUE'

' echo '
' break fi done echo '
' done cat <
EOT