Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not really (at least, not very easily). There's no guarantee that for whatever reason curl won't hang.

To do it properly, you'd need some code before the loop to start a separate process that would check on the parent process... but, really, you don't want to go there, not in Bash anyways.

But, assuming curl won't hang, you could compare timestamps. It's better than counting iterations (in terms of emulating timeout command).

But then, you might want to get fancy and implement exponential backoff or whatever other strategy you fancy to not overload the whatever thing you are polling... again, probably not in Bash.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: