blob: 20da6ef1fdcee98e5c9648ec058a2929a3fc74c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh -eu
lynx -nocolor -dump -listonly "${1:-https://example.com}" |
grep --color="never" "\." |
while read -r line; do
url=${line#*. }
head=$(wget \
--user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36" \
--timeout=1 \
--wait=1 \
--waitretry=1 \
--random-wait \
--no-cache \
--no-dns-cache \
--method=HEAD "$url" 2>&1 |
grep --color="never" -E 'HTTP')
response=$(printf '%s' "${head#*... }" | head --lines=1)
printf '%s %s\n' "$url" "$response"
printf '%s %s\n' "$url" "$response" >&2
done |
awk '{ print $1, $2, $3}' |
column \
--output-width 80 \
--table \
--table-columns URL,STATUS,MESSAGE \
--table-truncate URL |
sort --reverse --key=2
|