Skip to content

Instantly share code, notes, and snippets.

@paride
Created December 2, 2021 23:35
Show Gist options
  • Save paride/c0dd66fb3e1ba5899823155b1ab7a887 to your computer and use it in GitHub Desktop.
Save paride/c0dd66fb3e1ba5899823155b1ab7a887 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu -o pipefail
### retry script snippet
retry() {
((${_try:=1}>5)) && exit $? || echo sleep "$((8*_try**3))"
_try=$((++_try)) exec "$BASH" "${BASH_SOURCE[-1]}" "$@"
}
trap 'retry "$@"' ERR
### end of retry snippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment