如何通过命令行脚本找到所有连接设备的设备uuid? [英] How can I find the device uuid's of all connected devices through a command line script?
本文介绍了如何通过命令行脚本找到所有连接设备的设备uuid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在iOS设备上运行自动化测试。我希望不必总是连接所有设备。所以我想找到所有设备ID,然后只开始构建,部署和运行测试的过程,如果该设备已连接。
I am running automated tests on iOS devices. I want to not have to always have all devices connected. So I want to find all device id's and then only start the process of building, deploying, and running tests if that device is connected.
所以我的问题是,怎么能我通过shell脚本找到所有连接设备的设备uuid?
So my question is, how can I find the device uuid's of all connected devices through a shell script?
谢谢!
推荐答案
我在这里找到了一个关于使用多个设备的类似问题是我帮助我的答案形式:
I found a similar question about using multiple devices here is my form of the answer that helped me:
#!/bin/sh
i=0
for line in $(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'); do
UDID=${line}
echo $UDID
udid_array[i]=${line}
i=$(($i+1))
done
cnt=${#udid_array[@]}
for ((i=0;i<cnt;i++)); do
echo ${udid_array[i]}
done
这篇关于如何通过命令行脚本找到所有连接设备的设备uuid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文