DEV Community

Discussion on: How to run a command in your shell until it succeed

Collapse
 
marleythemanzan profile image
Alexander C. Wilcots

To maximize laziness, you can make it into a function called retry() and have the rsync command as the first argument.

Collapse
 
mayeu profile image
Mayeu

Yup, but I'm too lazy to maximize my laziness :D

Anyway, if somebody is wondering, something like that should do it (ugly, may be unsafe, you are warned):

function retry() {
  until $1 ;
  do
    echo "Retrying at `date -Iminutes`";
  done
}