#!/bin/sh while : ; do /usr/bin/avrdude -p atmega32u4 -c avr109 -U flash:w:$1 -P $2 [[ $? == 0 ]] && break done