Skip to content

Instantly share code, notes, and snippets.

@ohartl
Created March 31, 2015 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohartl/4f1fca117f7b2640de70 to your computer and use it in GitHub Desktop.
Save ohartl/4f1fca117f7b2640de70 to your computer and use it in GitHub Desktop.
check http status code with curl
#!/bin/bash
http_status=`curl -s -I https://de.php.net/distributions/php-5.6.7.tar.gz | grep HTTP/1.1 | awk {'print $2'}`
echo $http_status
if [ $http_status -eq 200 ]; then
echo "this is HTTP Status 200"
else
echo "not 200"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment