Skip to content

Instantly share code, notes, and snippets.

View booknara's full-sized avatar

Daehee Han booknara

  • Facebook.Inc
  • San Jose, CA
View GitHub Profile
@johnjohndoe
johnjohndoe / check-for-android-device.sh
Created April 16, 2013 17:54
Shell script which checks if any Android device is connected. I execute this script before processing a Maven project in order to save time when the device has fallen asleep.
#!/bin/bash
check-for-android-device() {
ADB_PATH="${ANDROID_HOME}/platform-tools"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Android device seems to be missing."