linkcheck.sh (Source)

1
2
3
4
5
6
7
8
9
#!/bin/bash

# Check links from inputfile for 4xx/5xx HTTP status code

while read link
do 
  echo -n -e "$link\t"
  curl --silent --head $link | head --lines=1 | cut --delimiter=" " --field=2  
done < $1 | grep --extended-regexp '[45][0-9]{2}'