Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Take the list of attached devices

when I type adb devices in the shell I get something like this

List of devices attached 
HT06RPQ002T1    device
HT06RPQ002T1    device

I want some shell script that will print just the ids of the phones for example in this case to print

HT06RPQ002T1
HT06RPQ002T1

if more devices are attached to print more ids...

Thanks

EDIT

I tried to put everything in a variable like this asd=adb devices but I do not have idea how to parse if I have one device attached or I have 10 devices...

like image 806
Lukap Avatar asked Jun 11 '12 08:06

Lukap


People also ask

What are attached devices?

Connected devices are physical objects that can connect with each other and other systems via the internet. They span everything from traditional computing hardware, such as a laptop or desktop, to common mobile devices, such as a smartphone or tablet, to an increasingly wide range of physical devices and objects.

What devices are attached to my network?

Open your router's mobile app and look for a tab that lists all the devices connected to your network. It might say Devices or Device Manager. If your router doesn't come with a companion app, try a free Wi-Fi analyzer app to monitor connected devices and the security of your network.


1 Answers

adb devices | awk 'NR>1 {print $1}'
like image 145
aphex Avatar answered Oct 01 '22 08:10

aphex