rwxrob-dot/scripts/checkurls
Rob Muhlestein 2ea0289e9f Rebase
2022-02-09 02:29:05 -05:00

27 lines
551 B
Bash
Executable File

#!/usr/bin/env bash
declare target="$1"
declare red=$'\033[38;2;255;0;0m'
declare grey=$'\033[38;2;100;100;100m'
declare green=$'\033[38;2;0;255;0m'
declare x=$'\033[0m'
if [[ -z "$(which muffet)" ]]; then
echo "${red}Requires ${grey}https://github.com/raviqqe/muffet ${red}be installed.${x}"
exit 1
fi
if [[ -z "$target" ]]; then
echo "usage: checkurls <pageurl>"
exit 1
fi
if [[ ${1:0:4} != http ]]; then
target="http://$1"
fi
muffet --one-page-only "$target"
if [[ $? -eq 0 ]];then
echo "${green}No Broken URLs detected.${x}"
fi