mardi 4 septembre 2018

How to add an if then statement to a value with multiple arguments using bash

I am storing 2 values in my TMP location: {time} and {status}

I want to add an if-then condition that checks for the status. If it is anything other than 100, I want it to print out a line saying "something is wrong". But display nothing if the value is equal to 100.

TMP=$(curl -X GET -sS -w "%{time},%{status}\n" -H )

if [ "$TMP" -ne "$100" ] then echo "something is wrong" fi

TMP Output:

1.207,100

If I remove %{time} and only use %{status}, the if-then command works. How would I do it for 2 input values?

I don't necessarily need to check for {time}, but if required, I can have an if condition for time that checks for anything greater than 4.000. It can have the same echo "something is wrong".

Aucun commentaire:

Enregistrer un commentaire