Running a command in your shell until it succeed
I am regularly copying big files over the internet via rsync
, and since I am
travelling a lot, I don’t generally have access to stable internet connection,
so I end-up rerunning the command multiple times until it succeeds.
Turns out there is a better way. Of course you could use while
and test the
return of the command, but that sounds like a lot of work for a ad hoc
command. But I am lazy and I recently discovered that an until
command exists!
Pretty straightforward to use:
|
|
So with rsync
you get:
|
|
And if you are really lazy, just create an alias (left as an exercise ;) ).
Did you enjoy this article? Don't want to miss any new posts and get exclusive content? Then hop into my newsletter :)
You can also contact me directly via email: m [-at-] mayeu [-dot-] me