Created
January 27, 2016 10:05
-
-
Save anandpathak/97e80044e20b46eb4211 to your computer and use it in GitHub Desktop.
Url status from using Curl command
This file contains 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 | |
#pass the input url file | |
#urls must be in new lines | |
File=$1 | |
while read url; do | |
status=$(curl -sI $url | head -1 | awk '{print $2}') | |
redirect=`curl -sI $url | grep "Location\|location" | awk '{print $2}'` | |
echo $url $status $redirect >>url_out.txt | |
done <$File | |
#check output in url_out.txt file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment