By saving the e - given that it is (re)assigned everytime we hit the until loop, if for any reason the 1st try went bad but a try later went well we exited with non-0 exit status because it was the saved one.
Given that we will exit only when retrying for too much times just replace the break with an exit of the last saved status (that should be non-0 and this time should be right!).
By saving the
e
- given that it is (re)assigned everytime we hit the until loop, if for any reason the 1st try went bad but a try later went well we exited with non-0 exit status because it was the saved one.Given that we will exit only when retrying for too much times just replace the
break
with anexit
of the last saved status (that should be non-0 and this time should be right!).