bash check curl response code code example
Example 1: get status code of curl
curl -o /dev/null -s -w "%{http_code}\n" http://localhost
Example 2: curl get return code
curl -I http://www.example.org
curl -o /dev/null -s -w "%{http_code}\n" http://localhost
curl -I http://www.example.org