#!/bin/bash RETURN=$(curl -o /dev/null -Isw '%{http_code}\n' ${1}) if [[ ${RETURN} =~ ^[2-4]{3}$ ]]; then echo "success" else echo "error" fi