test script:
#!/bin/bash
set -x
set -e
command -v retry >/dev/null
testfile=./testfile
echo "1
2
3" > "$testfile"
while read -r testvar ; do
true "testvar: $testvar"
retry --times=3 --delay=1 -- /bin/true &
pid=$!
wait "$pid"
true "WAIT OK"
done < "$testfile"
true "END"
chmod +x ./test
actual output:
+ set -e
+ command -v retry
+ testfile=./testfile
+ echo '1
2
3'
+ read -r testvar
+ true 'testvar: 1'
+ pid=395200
+ wait 395200
+ retry --times=3 --delay=1 -- /bin/true
+ true 'WAIT OK'
+ read -r testvar
+ true END
The loop runs actually only 1 time instead of the expected 3 times.