jeudi 28 janvier 2016

If/Else curl command not working

I am using a grep -c to count the occurrence of a phrase on a curl. Currently the code below return a number 12.

curl WEBSITEURL | grep -c "incident-title"

I want to use this in a single line if/else bash command that says that if the occurrence is greater than 0 then printf or else printf.

if curl WEBSITEURL | grep -c "incident-title" > 0; then printf "Investigating Issue"; else printf "Fully Operational"; fi

It keeps returning "Fully Operational" even though that it should be true as 12 is greater than 0.

Thank you in advance for your assistance.

Aucun commentaire:

Enregistrer un commentaire