diff mbox series

[oe-layersetup] git_retry.sh: remove let, use arithmetic evaluation

Message ID 20250321221755.57811-1-rs@ti.com
State Under Review
Delegated to: Ryan Eatmon
Headers show
Series [oe-layersetup] git_retry.sh: remove let, use arithmetic evaluation | expand

Commit Message

Randolph Sapp March 21, 2025, 10:17 p.m. UTC
From: Randolph Sapp <rs@ti.com>

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 <rs@ti.com>
---
 git_retry.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/git_retry.sh b/git_retry.sh
index 1ffee7a..5683eef 100755
--- a/git_retry.sh
+++ b/git_retry.sh
@@ -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