当我发出命令:
adb devices
我有这样的结果:
List of devices attached
192.168.1.200:5555 offline
192.168.1.201:5555 device
192.168.1.202:5555 unauthorized
192.168.1.203:5555 device
我有这样的庆典脚本,但是失败的,因为它的工作只有在连接设备:
#!/bin/bash
#init
a=$(adb devices | cut -f1 | cut -f1 -d\ );
echo $a;
for x in $a;
do
if [ "$x" == "List" ];
then continue;
fi;
echo $x
adb connect $x
done
如何只得到IPs从"设备"清单并跳IPs从其他值的列表?
device
在任何地方的路线,使它符合的标题。 使用awk
正如其他建议或至少grep 'device$'
锚定底onf行。