check-links.sh 415 Bytes
Newer Older
ale's avatar
ale committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/sh
#
# Local link checker. Runs by default against a local test instance,
# but it can be pointed at any live website using a command-line argument.
#

base_url=${1:-http://localhost:3300}

script_dir="$(dirname $0)"
script_dir="${script_dir:-.}"

"${script_dir}/find-links.sh" \
  | grep ^/ \
  | (while read url ; do
	curl -f -s -o- -L "${base_url}${url}" >/dev/null \
	|| echo "${url}    404"
     done)