I referred to multiple articles to solve my problem but no luck. I'm trying curl inside if; as the value comparison is an arithmetic operation, I'm using the > operator with ((.
However, the command is failing with error
bash: ((: > 0: syntax error: operand expected (error token is "> 0")
Here is my command:
if (( $(curl --max-time 10 $serviceName) > 0)); then echo ERROR ; fi
What is wrong in the command?
curlcommand actually output? Seems like it's not producing anything, which means the command reduces toif (( > 0 )); then. You need something for the left-hand operand to>.curlfailed (rather than its output), thenif ! curl ....; then echo ERROR: fiis what you want.