IFS=' ' sh templates/header.sh> 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" sh templates/header.sh > $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 sh templates/footer.sh >> $dest done sh templates/footer.sh >> dest/index.html