I just wanted to do a really simple comparison between 2 strings in Bash :
stat=`curl -Is $url | head -n 1`
echo $stat
if [ "$stat" = "HTTP/1.1 200 OK" ];then
echo "$symbol is OK"
echo $stat
valide=$(( $valide + 1 ))
else
echo "$symbol is 404"
echo $stat
err=$(( $err + 1 ))
fi
But even if "stat" is completely the same, the result stay that it does not equal :
HTTP/1.1 200 OK
AAA is 404
HTTP/1.1 200 OK
How can i modify my code ?
I had also a lot of errors with "/" ("unexpected operator", ...) in the string before arrive to this code sample, and i tried many different approaches like contains ("200") with the same result.
Thank you in advance !
Aucun commentaire:
Enregistrer un commentaire