I created this bash script and can't seem to figure out why my code inside of the if block isn't executing.
db_instances_status="creating"
db_instances_status=$(makes api request to get value)
COUNTER=0
while [ $COUNTER -lt 1 ]; do
db_instances_status=$(makes api request to get value)
echo "$db_instances_status" # echos available
if [ "available" = "$db_instances_status" ]; then
# code never makes it here
dosomething()
break;
fi
sleep 30
done
I followed examples from this How to compare strings in Bash
and here https://tecadmin.net/tutorial/bash/examples/check-if-two-strings-are-equal/