4 ms·
Show HN: `loop`, Unix's missing loop commmand
- Mizza 8y agoI have always found writing loops in Bash to be fickle, tedious, and needlessly complicated. `loop` allows you to write intuitive, powerful looping one liners, with many useful features like breaking on pattern matching, timed loops, and loops for a specific duration. For instance, to try a thing until it succeeds, every 15 seconds, for a maximum of five times in Bash: n=0 until [ $n -ge 5 ] do do_thing.sh && break n=$[$n+1] sleep 15 done becomes: loop './do_thing.sh' --every 15s --until-success --num 5 This was also my first Rust project, so feedback is welcome!
- Schumer 8y agoVery useful but nothing UNIX about it