An open-source entry in TopGit's GitHub warehouse: Miserlou/Loop, 695 stars, Rust. UNIX's missing `loop` command
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Loops can be set to timers which accept humanized times from the microsecond to the year with --every:
$ loop --every 5s -- date
Thu May 17 10:51:03 EDT 2018
Thu May 17 10:51:08 EDT 2018
Thu May 17 10:51:13 EDT 2018
Looping can be limited to a set duration with --for-duration:
$ loop --for-duration 8s --every 2s -- date
Fri May 25 16:46:42 EDT 2018
Fri May 25 16:46:44 EDT 2018
Fri May 25 16:46:46 EDT 2018
Fri May 25 16:46:48 EDT 2018
$
Or until a certain date/time with --until-time:
$ loop --until-time '2018-05-25 20:50:00' --every 5s -- 'date -u'
Fri May 25 20:49:49 UTC 2018
Fri May 25 20:49:54 UTC 2018
Fri May 25 20:49:59 UTC 2018
$
Until Conditions
loop can iterate until output contains a string with --until-contains:
loop can iterate until the output stays the same with --until-same. This would be useful, for instance,
for monitoring with du until a download or copy finishes:
If you have a lot of files and a program, but don't know which file is the one the program takes, you can loop over them until you find it:
$ ls -1 | loop --until-success -- './my_program $ITEM';
Or, if you have a list of files but need to find the one which causes your program to fail:
$ ls -1 | loop --until-fail -- './my_program $ITEM';
Waiting for a website to appear online
If you've just kicked off a website deployment pipeline, you might want to run a process when the site starts returning 200 response codes. With --every and --until-contains, you can do this without flooding the site with requests:
If you've got a whole list of files that you want to create backup copies of, you can do it like so:
$ ls
hello.jpg
$ ls -1 | loop -- 'cp $ITEM $ITEM.bak'
$ ls
hello.jpg
hello.jpg.bak
Keep trying a failing script until it passes, up to 5 times
This is an example from StackExchange.
I want to write logic in shell script which will retry it to run again after 15 sec upto 5 times based on "status code=FAIL" if it fails due to some issue.
There are so many questions like this on StackExchange, which all end up with long threads of complicated answers.
Which will do the thing every 15 seconds until it succeeds, for a maximum of five times.
Keep trying a failing script until timeout
If dealing with a command or script that occasionally fails in a CI environment, you may want to try for a given amount of time before giving up and failing the build.
Which will do the thing every 5 seconds until it succeeds or until the duration is met. If the duration is met, it will give the same non-zero return as the timeout command 124.
Comparison with GNU Parallel
This thread on Reddit with GNU Parallel author Ole Tange has some interesting side-by-side comparisons between loop and parallel.
More examples
Got any more useful examples? Send a pull request!
Contributing
This project is still young, so there is still plenty to be done. Contributions are more than welcome!
Please file tickets for discussion before submitting patches. Pull requests should target master and should leave Loop in a "shippable" state if merged.
If you are adding a non-trivial amount of new code, please include a functioning test in your PR. The test suite will be run by Travis CI once you open a pull request. Please include the GitHub issue or pull request URL that has discussion related to your changes as a comment in the code (example). This greatly helps for project maintainability, as it allows us to trace back use cases and explain decision making. Similarly, please make sure that you meet all of the requirements listed in the pull request template.
Please feel free to work on any open ticket, especially any ticket marked with the "help-wanted" label!
TopGit's last sync did not record any GitHub topics for Miserlou/Loop. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on Miserlou/Loop?
The most recent commit recorded on Miserlou/Loop was 4.1 years ago, based on the GitHub push timestamp. The repository has 28 forks — one of the better signals of community interest.
Is Miserlou/Loop open source?
Yes — Miserlou/Loop ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/Miserlou/Loop.
What license does Miserlou/Loop use?
Miserlou/Loop is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where can I see Miserlou/Loop in action?
The project maintains a homepage at https://github.com/Miserlou/Loop. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about Miserlou/Loop?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/Miserlou/Loop is the definitive source.
Read full README in the tab above.
Curious whether Loop is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about Loop.