Browse Source

checklinks: Použití, vypsání výstupu

export_seznamu_prednasek
Pavel "LEdoian" Turinsky 3 years ago
parent
commit
cbed53c65f
  1. 8
      checklinks.sh

8
checklinks.sh

@ -3,8 +3,16 @@
# Props to https://www.commandlinefu.com/commands/view/8234/check-broken-links-using-wget-as-a-spider # Props to https://www.commandlinefu.com/commands/view/8234/check-broken-links-using-wget-as-a-spider
set -eu set -eu
if test "$#" -lt 1; then
echo >&2 "Usage: $0 <wget parameters, especially URL to test>"
exit 1
fi
logfile="$(pwd)/wget.log.$(date +%FT%T)" logfile="$(pwd)/wget.log.$(date +%FT%T)"
tmp=$(mktemp --directory) tmp=$(mktemp --directory)
cd "$tmp" cd "$tmp"
wget --spider -o "$logfile" -r -p -X '/soustredeni/*/fotogalerie/' "$@" 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"

Loading…
Cancel
Save