1 #!/bin/bash 2 echo "Waiting for emulator to start..." 3 4 bootanim="" 5 failcounter=0 6 until [[ "$bootanim" =~ "stopped" ]]; do 7 bootanim=`adb -e shell getprop init.svc.bootanim 2>&1` 8 let "failcounter += 1" 9 # Timeout after 5 minutes. 10 if [[ $failcounter -gt 300 ]]; then 11 echo "Can not find device after 5 minutes..." 12 exit 1 13 fi 14 sleep 1 15 done 16 17