[wplug] tidy bash script
ARiley at edgarsnyder.com
ARiley at edgarsnyder.com
Fri Jul 23 16:46:14 EDT 2004
I experimented with the same sort of thing, writing a log file for each
file tidied. But after a while I decided to write all output to a central
file, which I've yet to grep for interesting messages (errors and
warnings). Simply using Tidy's configuration to write to a log file
doesn't work with this script; the last file tidied is all that remains
after each file overwrites instead of appending.
Just for fun - to get a centralized list of file names tidied one could
place this piece just inside the loop:
printf "\n$i\n" >> $err /* prints file names */
Anyway here's what I have to date - it works fairly well.
#!/bin/sh
#
########################################################################
#
## Use HTML Tidy to clean up html files, writing errors and warnings
## to a log file. Starts in the current directory and works on files in
path.
##
#
# Created: 07/22/04
#
config="/etc/tidy.conf"
err="/var/log/tidy.err"
for i in `find . -type f -name \*.html`;
do
tidy -config $config $i 2>> $err
done
More information about the wplug
mailing list