hi i am writings a small shell script. there i use curl command to call to api. what it return is a status of a scan.
{"status":"14"}
i want to get this status and check if it is less than 100; this is what i have done so far
a=0
while [ $a -lt 100 ]
do
curlout=$(curl "http://localhost:9090/JSON/spider/view/status/?zapapiformat=JSON&scanId=0");
echo "$curlout";
a=`expr $a + 1`
done
what i want to do is assign that status to $a; how to get read this json to get the value in shell script
sed -r '/status/s/^.*"([0-9]+).*$/\1/' <<< "$curlout"worked for you?echo '{"status":"14"}' | tr -cd '0-9\n'?curl "http://localhost:9090/JSON/spider/view/status/?zapapiformat=JSON&scanId=0". And what is the purpose of incrementing the value ofstatusif it's always static?