curl for response code
February11
This is handy, you can use:
curl -w %{http_code} url
to retrieve the http response code for a given url.
Bash script for parsing my lotto results:
#!/bin/bash
count=0;
var1=0;
exec<"lotto.txt"
while read line
do
if [ $[$count % 2] -eq "0" ];
then
var1=$(echo $line | awk '{ print $1 $2 $3}');
echo $line;
else
var2=$(echo $line[-1] | awk '{ print $1 $2 $3}');
echo $var1 $line;
#echo $date1
fi
let "count+=1";
done
//
That code is A1 – Shamoan!
Thanks for the post. I’m using the output to assign the return code to a variable. Works great.
code=$(curl -so/dev/null -w %{http_code} $url)