diff --git a/scanLauncher.sh b/scanLauncher.sh
index 482fcfa26e53383c5a2da4be8ddf44be9fef9b08..452b363f80afa945f0a2216f08e51df2baba8794 100755
--- a/scanLauncher.sh
+++ b/scanLauncher.sh
@@ -153,11 +153,14 @@ max_reps=$(jq -j '.common_config.max_trials_in_case_of_failure' $SCANCFG)
 START_YR=$(date +%s.%N)
 
 reps=0; retval=-1
-while [ retval != 0 ]; do
+while [ true ]; do
     ((reps++))
 
     $comm   # call Yarr
     retval=$?
+    if [ $retval -eq 0 ]; then
+        break
+    fi
 
     if [ $retval -ne 0 ] && [ $reps -ge $max_reps ]; then 
         echo "[ warn ][sl] After $max_reps attempts, couldn't succesfully finish $scanName."