How to return a error code in bash if a condition is not true?

0

I'm using Travis-ci for a continuous integration process, however, I'm having difficulty performing a specific validation after installing some components (apache, php ...).

I currently have the following verification (this is the validation test):

STRING=$(curl -Is --head "$URL_CURL_CHECK" | grep -o "HTTP/1.1 200 OK")
function check {
    if [[ $STRING == "HTTP/1.1 200 OK" ]]; then
        echo "sucesso"
    else
        echo "error"
    fi
}

URL_CURL_CHECK receives the URL to be scanned. I would like to be able to throw an exception in Travis-ci if the condition of this if was not successful, or rather code return 0. Any idea how to do this?

    
asked by anonymous 21.01.2018 / 17:31

0 answers