checklinks: Použití, vypsání výstupu
This commit is contained in:
parent
08963271b5
commit
cbed53c65f
1 changed files with 8 additions and 0 deletions
|
@ -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…
Reference in a new issue