用SHELL脚本随机执行按键事件

stress.sh
#!/bin/bash
【用SHELL脚本随机执行按键事件】declare -i menusum
declare -i homesum
declare -i powersum
declare -i randomcommand;
menusum=0;
homesum=0;
powersum=0;
while :
do
randomcommand=$RANDOM;
randomcommand=$((randomcommand % 3));
#echo "$randomcommand";
if [[ 0 == $randomcommand ]]
then
adb shell input keyevent 82;
menusum=menusum+1;
elif [[ 1 == $randomcommand ]]
then
adb shell input keyevent 3;
homesum=homesum+1;
elif [[ 2 == $randomcommand ]]
then
adb shell input keyevent 26;
powersum=powersum+1;
fi
echo "input menu: $menusum home:$homesum power:$powersum";
done
先执行
$chmod 777 ./stress.sh
$ ./stess.sh

    推荐阅读