From kromonos, 4 Months ago, written in Bash.
Embed
  1. #!/bin/bash
  2.  
  3. RETURN=$(curl -o /dev/null -Isw '%{http_code}\n' ${1})
  4. if [[ ${RETURN} =~ ^[2-4]{3}$ ]]; then
  5.     echo "success"
  6. else
  7.     echo "error"
  8. fi