One-Liner CURL loop
I needed to check the HTTP response codes for 100 requests to observe any issues with the reachability of the website. This short one liner is doing the job:
for ((i=1;i<=100;i++)); do REQUEST=`curl -m 5 -LI https://www.saferpay.com -o /dev/null -w '%{http_code}\n' -s`;if [[ "$REQUEST" -ne 200 ]]; then echo -n '-';else echo -n '+';fi;sleep 3;done
Sending every 3 seconds a curl request, parse the HTTP response code, prints ‘+’ for 200 and ‘-’ for anything except 200.
Done.
Cheers mate,