1#!/bin/bash 2echo "Waiting for emulator to start..." 3 4bootanim="" 5failcounter=0 6until [[ "$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 15done 16 17