[Discuss] Bash script help
brendan
brendan at ming.org
Sat Mar 1 18:58:08 PST 2014
either of these will work:
adb devices | grep 3230ce87e28a70b9 | awk '{print $1'}
adb devices | grep 3230ce87e28a70b9 | cut -f1 -d' '
On 14-03-01 12:16 PM, John Blomfield wrote:
> Ooops some corrections!
>
> On 03/01/2014 12:13 PM, John Blomfield wrote:
>> I want to test that my Android device is connected to my PC usb
>> before doing other stuff on the ADT sdk in the script ...............
>>
>> ................
>> adb devices
>>
>> #results in
>> List of devices attached
>> 3230ce87e28a70b9 device
>> # if its connect or
>> List of devices attached
>>
>> # an empty list if its not if I run
>>
>> adb devices | grep 3230ce87e28a70b9
>>
>> # I get
>> 3230ce87e28a70b9 device
>>
>> #How do I extract the number 3230ce87e28a70b9 as a variable
>> $DEVICENUM so I can test it in an "if" statement e.g.
>>
>> if [ 3230ce87e28a70b9 = $DEVICENUM ] ; then
>> ......................more stuff
>>
>> Thanks John
>>
>>
>>
>
>
More information about the Discuss
mailing list