使用 adb shell getprop 命令
adb shell getprop | grep ro.product.model | cut -d' ' -f2 | cut -d'[' -f2 | cut -d']' -f1
-
第一个 cut 命令执行后得到中括号括起来的 model name,后面 2 个 cut 命令用以去掉前后中括号
adb shell getprop.png
-
如果获取到的 model name 用于 python 脚本中,用字符串切片 [1:-1] 就更简单了
使用 adb devices 命令
adb devices -l | tail -n +2 | awk '{print $5}' | cut -d: -f2
相比于 getprop 得到的大量信息,这个命令执行效果更直观一些,执行过程如下图:
![](https://img.haomeiwen.com/i10187070/b7c6b9a05f0daaab.png)
网友评论