데 문제 비교하는 2 코드에서는 쉘입니다. 실행하고 검사해야 합 경우 응답이 200 400. 또한,의 기회가 있다는 응답을 수"000"면 서버가 다운되었습니다.
#!/bin/sh
response1="200" #curl first url
response2="000" #curl second url
if (( $response1 -ge 400 || $response1 -lt 200 || $response2 -ge 400 || $response2 -lt 200 )) ; then
echo "Something went wrong, response code is not in success range"
exit 1
else
echo "Success"
exit 0
fi
((:200-ge400 || 200 -lt200 || 000 -ge400 || 000 -lt200:구문 오류 식(오류가 토큰"400 || 200 -lt200 || 000 -ge400 || 000 -lt200")
변경하는 경우 괄호[[...]]그것은 항상 true 를 반환합니다. 변경하는 경우-lt<와 창기>=얻는 다음과 같은 오류가:
((: 200 = 400 || 200 < 200 || 000 = 400 || 000 < 200 : 을 시도 할당을 아닌 변수(오류가 토큰"= 400 || 200 < 200 || 000 = 400 || 000 < 200 ")