#!/bin/bash
#
#   siteget - Use wget to retrieve a website
#
if [ "$#" -ne "1" ]
then
   echo "$(basename ${0}) <URL>"
   echo ""
   echo "Get a website or book on the web using wget.  It's a one-liner, but"
   echo "it uses a lot of options, so I put it in a script.  Takes one option,"
   echo "a top-level URL."
   exit 1
fi

# --mirror gives infinite recursion, follows links ...
# --convert-links converts links for local viewing
# --no-verbose is a relatively quiet (but not silent) mode
# --no-parent won't traverse up the tree - don't know how this combines with
#    "page-requisites," but I hope the latter wins ... (seems to work well)
# --page-requisites get images (inline OR external) for local viewing
# --user-agent sets a user agent string because some sites send empty pages if
#    they don't like wget, so I use the string for what I'll be viewing with
#
cd /home/kolan/websites
wget --mirror --convert-links --no-verbose --no-parent --page-requisites \
   --user-agent="Mozilla/5.0 (compatible; Konqueror/3.0.0/10; Linux)" ${1}

