Last active
November 13, 2020 17:07
-
-
Save m-rey/1517fcd261859e0a3f4cb45d5171fe56 to your computer and use it in GitHub Desktop.
script to check if list of urls is reachable (2xx HTTP response)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read line; do url_return=($(curl -s -o /dev/null -IL -m 10 -w "%{http_code} %{url_effective}" "$line")); if [ ${url_return[1]} -ge 200 ] && [ ${url_return[1]} -lt 300 ] ; then echo "${url_return[@]:1}">>"url_reachable.txt"; else echo "${url_return[@]:1}">>"url_failed.txt"; fi; done<url.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment