utility
Bounded readiness polling
Application pattern, not a builtin. Bound individual requests and overall deadline, distinguish pending from fatal errors; example uses a local counter.
Formal Syntax & Structure
bash syntaxbash
for ((i=1;i<=MAX;i++)); do ...; doneReturn Value
exit status
Application pattern, not a builtin. Bound individual requests and overall deadline, distinguish pending from fatal errors; example uses a local counter.
Working Example
Example Snippetbash
attempt=0probe() { (( ++attempt >= 3 )); }for ((i=1;i<=4;i++)); do if probe; then printf 'ready=%s\n' "$i"; exit 0; fi printf 'pending=%s\n' "$i" (( i == 4 )) || sleep 0.01doneexit 1