Created
May 24, 2014 15:53
-
-
Save m13253/e85f584b97394b3e0604 to your computer and use it in GitHub Desktop.
A shell script to keep trying a command until it succeeds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| _RETRY_COUNT=0 | |
| while true | |
| do | |
| ("$@") && break | |
| let _RETRY_COUNT=${_RETRY_COUNT}+1 | |
| echo -e "\e[1;31mRetry ${_RETRY_COUNT}...\e[0m" | |
| sleep 0.5; echo -ne '\a'; sleep 0.5; echo -ne '\a'; sleep 0.5; echo -ne '\a'; sleep 0.5 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment