#!/bin/bash # # Find and create php threadlist and maillist files. genFile () { FILE=$1 OUTFILE=${FILE%.html}.php CREATE=no if [ ! -e $OUTFILE ]; then CREATE=yes else if [ -n "$(grep -L 'Home' $OUTFILE)" ]; then CREATE=yes fi fi if [ $CREATE = "yes" ]; then echo "$FILE needs editing, creating $OUTFILE" sed -e "s/
/&\n[Home<\/a>][${YEAR} Index<\/a>]/i" $FILE > $OUTFILE fi; } #for YEAR in $(seq 1994 2013) ; do for YEAR in 2013 ; do for FILE in $(find $YEAR -name "maillist.html"); do genFile $FILE done for FILE in $(find $YEAR -name "threads.html"); do genFile $FILE done done