#!/bin/sh
# Script to convert pages with Apache SSI to PHP.
# The command_file contains the sed(1) commands performed.
# Warning: site specific - not intended for general use.

test $2 || { echo usage: $0 command_file directory ...; exit 0; }

command_file=`realpath $1`
shift

for dir
do
  find $1/ -name "*.shtml" -execdir sh -c "
    phpfile=\`basename {} shtml\`php
    cp {} \$phpfile # add -i here to prevent silent overwriting
    sed -i '' -f $command_file \$phpfile
  " \;
done
