git_retry.sh: remove let, use arithmetic evaluation
PATCH 1/1 git_retry.sh: remove let, use arithmetic evaluation
From: Randolph Sapp <[email protected]>
Since none of this script is checking the exit code of let, we can replace it with a standard arithmetic evaluation and switch the shebang to a POSIX shell.
According to bash(1) let simply performs an arithmetic evaluation with an additional check that returns 1 if the last arg evaluates to 0.
Signed-off-by Randolph Sapp <[email protected]>
--- git_retry.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
git_retry.sh +8 -8
@@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh -let glMaxRetries=5 -let glCurrRetry=1 -let glDelay=15 -let glExitCode=0 +glMaxRetries=5 +glCurrRetry=1 +glDelay=15 +glExitCode=0 while [ $glMaxRetries -ge $glCurrRetry ]; do
@@ -15,16 +15,16 @@ while [ $glMaxRetries -ge $glCurrRetry ]; do exit fi - let glSleep=$glDelay*$glCurrRetry + glSleep=$((glDelay*glCurrRetry)) - let glRemainingRetries=$glMaxRetries-$glCurrRetry + glRemainingRetries=$((glMaxRetries-glCurrRetry)) if [ $glRemainingRetries -gt 0 ]; then echo "git failed... remaining attempts: $glRemainingRetries sleeping $glSleep seconds" sleep $glSleep fi - let glCurrRetry=$glCurrRetry+1 + glCurrRetry=$((glCurrRetry+1)) done
Signature · 1 line
2.49.0