bash - How do I automatically retry an SFTP connection attempt? -


is there option have bash retry sftp connection n number of times or x seconds? i'm unable find info on making shell script automatically retry, regardless of cause of error (server down, bad password, etc).

try try 3 times:

c=0; until sftp user@server; ((c++)); [[ $c -eq 3 ]] && break; done 

long version error message:

c=0 until sftp user@server;   ((c++))   if [[ $c -eq 3 ]];     echo error     break   fi done 

Comments