Skip to content

Instantly share code, notes, and snippets.

@anandpathak
Created January 27, 2016 10:05
Show Gist options
  • Save anandpathak/97e80044e20b46eb4211 to your computer and use it in GitHub Desktop.
Save anandpathak/97e80044e20b46eb4211 to your computer and use it in GitHub Desktop.
Url status from using Curl command
#!/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