Having some difficulty figuring this one out. I am looking to add a counter to my While loop within Bash. I have /usr/bin/profiles checking to see if a configuration profile has made it on to the machine before continuing on. This config profile will make its way to the machine after the script removes a cert in key chain which in turn will remove it from a smart group via recon. After this action, it will become relevant to take on the config profile. This while loop on the other hand will wait for the config profile to come down, but I would like it to time out after say... 20 loops.
Here is the snippet (sensitive info will be subbed out)
#!/bin/sh
Profile=B2173820-3729-2819-2839-389283382192
lookUp=$(usr/bin/profiles -C | grep "${Profile}")
while [[ "$lookUp" == "" }}; do
echo "Profile does not exist, will continue to check"
sleep 5
lookUp=$(usr/bin/profiles -C | grep "${Profile}")
done
While loop works as is. Any suggestions on adding a counter? I have tried a few ways, but I have a feeling I am just not grasping on the concept of it.