mirror of
https://github.com/thegeeklab/retry.git
synced 2024-11-24 12:20:39 +00:00
add environment variable for retry attempt number; fix #9
This commit is contained in:
parent
3b9de02bd8
commit
2bbab739dc
3
retry
3
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
|
||||
|
Loading…
Reference in New Issue
Block a user