Skip to content

Instantly share code, notes, and snippets.

@m13253
Created May 24, 2014 15:53
Show Gist options
  • Select an option

  • Save m13253/e85f584b97394b3e0604 to your computer and use it in GitHub Desktop.

Select an option

Save m13253/e85f584b97394b3e0604 to your computer and use it in GitHub Desktop.
A shell script to keep trying a command until it succeeds
#!/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