-
-
Save bobzoller/0707ee8ce425c2151c53 to your computer and use it in GitHub Desktop.
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
function retry { | |
local retry_max=3 | |
local count=$retry_max | |
while [ $count -gt 0 ]; do | |
"$@" && break | |
count=$(($count - 1)) | |
sleep 1 | |
done | |
[ $count -eq 0 ] && { | |
echo "Retry failed [$retry_max]: $@" >&2 | |
return 1 | |
} | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment