IFS=' ' cat templates/header.html > dest/index.html for file in `find src -type f -name "*.md"` do src=$file dest=`echo $file |sed -e 's/^src/dest/' -e 's/md$/html/'` echo "SRC: $src DEST: $dest" cat templates/header.html > $dest cat templates/cardbegin.html >> $dest markdown_py $src >> $dest sh templates/date.sh $src >> $dest cat templates/cardend.html >> $dest cat templates/cardbegin.html >> dest/index.html markdown_py $src >> dest/index.html sh templates/date.sh $src >> dest/index.html cat templates/cardend.html >> dest/index.html cat templates/footer.html >> $dest done cat templates/footer.html >> dest/index.html