Skip to content

Instantly share code, notes, and snippets.

@uhziel
Created January 30, 2020 05:46
Show Gist options
  • Save uhziel/b7ebcd2b002fd5da2ef250c8eeb120ac to your computer and use it in GitHub Desktop.
Save uhziel/b7ebcd2b002fd5da2ef250c8eeb120ac to your computer and use it in GitHub Desktop.
#!/bin/bash
function check_url_exist {
# via https://stackoverflow.com/questions/12199059/how-to-check-if-an-url-exists-with-the-shell-and-probably-curl/12199125
url=$1
if curl --output /dev/null --silent --head --fail "$url"; then
echo "URL exists: $url"
#else
#echo "URL does not exist: $url"
fi
}
function check_urls_exist {
for ((i=$1; i<=$2; i++))
do
check_url_exist "http://www.china.com.cn/chinese/zhuanti/feiyan/$i.htm"
done
}
check_urls_exist 325398 326489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment