This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.Ken Thomson, quoted in A Quarter Century of Unix
Much of the work in building a website is performing various, repetitive actions on many files
Just for fun, this is how you could theoretically register a domain here in South Africa.
curl -O http://co.za/coza_reg.txt
$EDITOR coza_reg.txt
cat coza_reg.txt | mail -s "plz register jozilug.co.za" coza-admin@co.za
# apt-get install tidy
find $SITELOC -name "*.html" -exec echo {} \; -exec tidy -quiet -errors {} \;
wget -o ~/wget-output.txt --page-requisites http://127.0.0.1 &&
grep ^Downloaded ~/wget-output.txt
# Downloaded: 12 files, 188K in 0.001s (247 MB/s)
find $SITELOC -name *.jpg | xargs -P 4 -n 1 jpegoptim --strip-all
find $SITELOC -name *.png | xargs -P 4 -n 1 optipng -quiet -o7 -strip all
Instead of find's -exec switch, I pipe to xargs; - P 4 runs 4 commands in parallel!
wget -o ~/wget_errors.txt --spider --execute="robots=off" --recursive --page-requisites http://127.0.0.1:4000
EXIT_CODE=$?
if [ $EXIT_CODE -gt 0 ]; then
echo "ERROR: Found broken link(s)"
grep --before-context=2 '404' ~/wget_errors.txt
exit 1
fi
rm ~/wget_errors.txt
rsync --quiet --copy-dirlinks --delete --archive --verbose --update ~/public_html $REMOTE
#lftp -u user,password -e "mirror --delete --verbose --only-newer --continue --reverse $LOCAL $REMOTE; bye" www.yourdomainyo.co.za