UPD=1 echo $UPD while [ $UPD > 0 ]; do echo "Waiting for DB to be updated..." sleep 1 UPD=`mpc | grep "Updating DB" | wc -l` echo $UPD done