Take the list of attached devices

android, bash, linux, shell

Solution

adb devices | awk 'NR>1 {print $1}'

Problem

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...

Original source