52 lines
1.0 KiB
Bash
Executable File
52 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# . CONFIG.sh
|
|
|
|
# set -o xtrace ## To debug scripts
|
|
# set -o errexit ## To exit on error
|
|
# set -o errunset ## To exit if a variable is referenced but not set
|
|
|
|
|
|
|
|
function main() {
|
|
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
|
|
domain=''
|
|
path=''
|
|
verbose='false'
|
|
|
|
cd "${SCRIPTPATH}"
|
|
echo "Working Dir: " $(pwd)
|
|
|
|
while getopts 'dp:v' flag; do
|
|
case "${flag}" in
|
|
d) domain="${OPTARG}" ;;
|
|
p) path="${OPTARG}" ;;
|
|
v) verbose='true' ;;
|
|
*) print_usage
|
|
exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "${domain}" || -z "${path}" ]]; then
|
|
print_usage
|
|
exit 1
|
|
fi
|
|
|
|
wget \
|
|
--recursive \
|
|
--no-clobber \
|
|
--page-requisites \
|
|
--html-extension \
|
|
--convert-links \
|
|
--restrict-file-names=windows \
|
|
--domains "${domain}" \
|
|
--no-parent \
|
|
"${path}"
|
|
}
|
|
|
|
print_usage() {
|
|
printf "Usage: -d for domain and -p for the starting path..."
|
|
}
|
|
|
|
main $@;
|