Created
May 11, 2020 06:47
-
-
Save anujkaushal/0328db67a2f8673315b9f71ed36966ed to your computer and use it in GitHub Desktop.
Check response code of URLs using input file
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 | |
input="./urls.txt" # input file for list of URLs | |
output="./result.txt" # output file | |
echo "ResponseCode, URL" > $output | |
while IFS= read -r line | |
do | |
status_code=$(curl --write-out %{http_code} --silent --output /dev/null $line) | |
outputStr=$(echo "$status_code, $line") | |
echo $outputStr | |
echo $outputStr >> $output | |
done < "$input" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment