dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 94886481ddcde4be604432e496f3d1950ca6c648
parent eca51d24923183fe2c357a2160f9f41cb06b4735
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Fri, 29 Mar 2019 02:16:48 +0100

checklinks - check broken links

Uses wget to check broken links on a website in a simple way. Also means
that I don't have to remember all of the flags. Just 'checklinks url
logfile' and it does everything for me.


Former-commit-id: e1a484332fb73bdc516562d5375427af8423608e
Diffstat:
Ascripts/checklinks | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/scripts/checklinks b/scripts/checklinks @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +if ! command -v wget &> /dev/null; then + echo "Please install wget." + exit 1 +elif [ $# -ne 2 ]; then + echo "Usage:" + echo "checklinks [URL] [LOGFILE]" +fi + +flags=(--spider --recursive --no-directories --no-verbose --page-requisites --level inf --wait 2 -e robots=off) + +wget "${flags[@]}" -o "$2" "$1" + +grep -B 1 'broken link!' "$2" | less