stat=`wget -nv --spider $URL 2>&1 | grep -c '200 OK'` if wget -nv --spider $URL 2>&1 | grep -q "200 OK"; then # do something else # do something fi