werc/bin/md_cache
2008-09-15 07:18:47 +02:00

18 lines
346 B
Bash
Executable File

#!/usr/bin/env rc
. 9.rc
cachedir=/tmp/md_cache
mkdir -p $cachedir >[2]/dev/null
tmpfile=$cachedir/mdtmp.$pid
score=`{{tee $tmpfile || exit 1} | sha1sum}
cachefile=$cachedir/$score
if(test -f $cachefile)
cat $cachefile
if not {
markdown.pl < $tmpfile | tee $cachefile.$pid
mv $cachefile.$pid $cachefile
}
rm $tmpfile >[2]/dev/null