Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created January 19, 2017 16:22
Show Gist options
  • Save mcatta/adcc5e7c20c9fabc44709d48e5321805 to your computer and use it in GitHub Desktop.
Save mcatta/adcc5e7c20c9fabc44709d48e5321805 to your computer and use it in GitHub Desktop.
Bash script to check if usb device is connect via adb
!/bin/bash
#IP='1216.58.205.195'
function pingDevice {
#ping -c1 -t300 $IP 2>/dev/null 1>/dev/null
#if [ "$?" = 0 ]
if adb get-state 1>/dev/null 2>&1
then
echo "Host found"
else
echo "Host not found"
fi
}
while [ 0 = 0 ]; do
pingDevice
sleep 5
done;
@WuglyakBolgoink
Copy link

Maybe better add shebang line like:

#!/usr/bin/env bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment