#! /bin/sh cat < EOD while IFS=': ' read field value; do case "$field" in "") break ;; Title) # echo strips leading and trailing whitespace title=$value ;; Header) printf " %s\n" "$value" ;; esac done tmpl=$(dirname $0) cat <$title

$title

EOD cat $tmpl/head.tmpl markdown cat $tmpl/foot.tmpl cat < EOD