-
-
Save gali1/6898a1bb78e7ef14d62db128ad64afec to your computer and use it in GitHub Desktop.
Url status from using Curl command
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 | |
#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