From cbed53c65f3d8c206280262d4624a1fc5bf1215b Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Tue, 2 Nov 2021 00:11:22 +0100 Subject: [PATCH] =?UTF-8?q?checklinks:=20Pou=C5=BEit=C3=AD,=20vyps=C3=A1n?= =?UTF-8?q?=C3=AD=20v=C3=BDstupu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- checklinks.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/checklinks.sh b/checklinks.sh index 63898075..19557e3a 100755 --- a/checklinks.sh +++ b/checklinks.sh @@ -3,8 +3,16 @@ # Props to https://www.commandlinefu.com/commands/view/8234/check-broken-links-using-wget-as-a-spider set -eu +if test "$#" -lt 1; then + echo >&2 "Usage: $0 " + exit 1 +fi + logfile="$(pwd)/wget.log.$(date +%FT%T)" tmp=$(mktemp --directory) cd "$tmp" wget --spider -o "$logfile" -r -p -X '/soustredeni/*/fotogalerie/' "$@" + +echo "Result: (a last few lines of the file $logfile)" +sed -ne '/^Found [0-9]* broken links/,$ p' "$logfile"