When writing shell scripts, I repeatedly have the need to wait for a given condition to become true, e.g. a remote URL becoming available (checked with curl) or a file that should exist, etc.
Ideally, I'd like to have a function or script await such that I can write, e.g.,
await [[ some condition ]]
and it would check the condition every second until it becomes true or a timeout occurs. Ideally I can set the polling interval and the timeout.
Is there a tool for this out there?