Linux command one-liner that keeps repeating until it fails n times

How do I write a retry logic in script to keep retrying to run it upto 5 times?

Borrow more. Repeat the same command about 5 times.

for i in 1 2 3 4 5; do command && break || sleep 15; done

Recommended Posts

Linux command one-liner that keeps repeating until it fails n times