#!/bin/sh usage() { cat << EOF Usage: $0 [url] [filters] [-h|--help|--wget|--httrack] --wget Select GNU Wget --httrack Select httrack to vacuum -h,--help Show this help Filters only work with httrack. \`man httrack\` to get help EOF } for i in "$@"; do if [ "$i" = "-h" ] || [ "$i" = "--help" ]; then usage exit 0 elif [ "$i" != "--httrack" ] && [ "$i" != "--wget" ]; then URL="$URL $i" elif [ "$i" = "--httrack" ]; then TOOL=httrack elif [ "$i" = "--wget" ]; then TOOL=wget fi done if [ -z "$URL" ]; then printf "Example: https://www.example.com +assets.example.com/*\n\n" while test -z "$URL"; do printf "URL: " read URL done fi if [ -z "$TOOL" ]; then while test -z "$TOOL"; do printf "Vacuum:\n" printf " [1] httrack\n" printf " [2] wget\n" printf "> [1] " read TOOL if [ -z "$TOOL" ]; then TOOL=1 fi if [ "$TOOL" = "1" ] || [ "$TOOL" = "httrack" ]; then TOOL=httrack elif [ "$TOOL" = "2" ] || [ "$TOOL" = "wget" ]; then TOOL=wget else TOOL= fi done fi if [ "$TOOL" = "httrack" ]; then COMMAND="httrack $URL" else COMMAND="wget --progress=bar -E -r -k -np --no-check-certificate --user-agent=Firefox $URL" fi cat << EOF Command: $COMMAND EOF exec $COMMAND