#!/bin/ksh
# chdir to working directory
cd src/posts
cat <<'EOF'
Welcome!
Welcome to my little place on the web. It may not been the pretties
you've seen today, but it's all self made.
Posts
Date
|
Article
|
EOF
# print list
ls -r1 *.ps *.pm *.ph *.pa *.pt 2>/dev/null | fgrep -v '.draft.' | while read line
do
echo ""
DATE="$(echo "$line" | cut -d"_" -f1 )"
if [ $(echo "${line##*.}") == "pm" ]
then
TITLE="$(head -1 "$line" | sed 's/^# //g')"
else
TITLE="$(echo "${line%%.*}" | tr '_' ' ')"
fi
URI="posts/${line%.*}.html"
cat <
$DATE
$TITLE
|
EOF
echo "
"
done
cat <
EOF