一个Linux下adb shell截屏脚本

记录一下。

#!/bin/bash

NAME=$(date +%Y%m%d-%H:%M:%S).png
adb shell /system/bin/screencap -p /sdcard/$NAME
adb pull /sdcard/$NAME ~/Pictures/

# the '[' and ']' should have space with left and right
if [ $? -eq 0 ]
	then
	echo -e "\033[32m *Screenshot save successfully.\n *The Path is ~/Pictures/${NAME} \033[0m"
	else
	echo "\033[31m *Screenshot save failed \033[0m"
fi

高亮不太好,截个图吧:

一个Linux下adb shell截屏脚本_第1张图片

你可能感兴趣的:(一个Linux下adb shell截屏脚本)