From 4a43cd79f1cd901f7988260b1872d1d306f2a848 Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 20 Jul 2010 14:34:25 +0100 Subject: First draft of unburn article, and article build infrastructure --- dirindex.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 dirindex.sh (limited to 'dirindex.sh') diff --git a/dirindex.sh b/dirindex.sh new file mode 100755 index 0000000..127a4c0 --- /dev/null +++ b/dirindex.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +t=`echo $1 | sed -e 's/.*\/\([^\/]*\)/\1/' -e 's/^./\U&/g'` +echo "$t" +echo "=======================================================================" +echo "" + +# list of files sorted by modtime +find $1 -type f -name '*.txt' ! -name 'index.*' -printf '%T@ %p\n' \ +| sort -r -n | awk '{print $2}' | while read f; do + reluri=`echo $f | sed 's/.*\/\([^\/]*\)\.txt/\1/'` + title=`sed -e 's/# //' -e 1q < $f` + + echo -n "- [$title]($reluri)" + if test `grep -c '^### ' < $f` -ne 0; then + subtitle=`sed -e 's/### //' -e 4q < $f | tail -n 1` + echo -n ": $subtitle" + fi + echo "" +done + +exit 0 -- cgit v1.2.3