Skip to content

Instantly share code, notes, and snippets.

@mattak
Last active December 14, 2015 14:19
Show Gist options
  • Save mattak/5099636 to your computer and use it in GitHub Desktop.
Save mattak/5099636 to your computer and use it in GitHub Desktop.
android easy screen capture
#!/bin/sh
#
# Android easy screen capture.
#
# usage:
# ashot
# ashot shot1.png
#
# args for adb
if [ $# -eq 2 ]; then
ADB="adb -s $1"
else
ADB="adb"
fi
shift
# args for savepath
SAVE_PATH=screenshot.png
if [ $# -eq 1 ]; then
SAVE_PATH=$1
fi
IMG_PATH=/sdcard/tmp.png
$ADB shell screencap -p $IMG_PATH
$ADB pull $IMG_PATH $SAVE_PATH
$ADB shell rm $IMG_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment