Skip to content

Instantly share code, notes, and snippets.

@gali1
Forked from anandpathak/UrlStatus.sh
Created February 28, 2022 22:01
Show Gist options
  • Save gali1/6898a1bb78e7ef14d62db128ad64afec to your computer and use it in GitHub Desktop.
Save gali1/6898a1bb78e7ef14d62db128ad64afec 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