Bash file: Keep running a program until it’s successful

I’m trying to reflash my motherboard bios using ch341a tool, the utility i use is flashrom . What’s my challenge? the challenge to connect the tool to the bios, the connection needs to do some tweak, i just want to focus on tweaking, i would like my computer to keep running the program while i try to connect, if the program connect successfully, it should stop. I came up with this simple script

while :
do
  flashrom --programmer ch341a_spi -r backup1.bin && exit
  sleep 2
done

Leave a Reply

Your email address will not be published. Required fields are marked *