diff --git a/retry b/retry index 321a394..402c517 100755 --- a/retry +++ b/retry @@ -44,13 +44,14 @@ retry() P="$1" for param in "${@:2}"; do P="$P '$param'"; done #TODO: replace single quotes in each arg with '"'"' ? + export RETRY_ATTEMPT=$attempts bash -c "$P" return_code=$? #__log_out "Process returned $return_code on attempt $attempts" if [ $return_code -eq 127 ]; then # command not found exit $return_code - else + elif [ $return_code -ne 0 ]; then attempts=$[$attempts +1] fi done