小智 18
这是一个鱼壳单行(参见下面的bash)
bluetoothctl devices | cut -f2 -d' ' | while read uuid; bluetoothctl info $uuid; end|grep -e "Device\|Connected\|Name"
Run Code Online (Sandbox Code Playgroud)
bash一行:
bluetoothctl devices | cut -f2 -d' ' | while read uuid; do bluetoothctl info $uuid; done|grep -e "Device\|Connected\|Name"
Run Code Online (Sandbox Code Playgroud)
小智 5
您可以列出已配对的设备bluetoothctl paired-devices
从此列表中,您可以获取每个设备的信息,并bluetoothctl info
在信息中显示“已连接”状态。
因此,在每个设备上循环 grep for Connected: yesif so 显示名称:
bluetoothctl paired-devices | cut -f2 -d' '|
while read -r uuid
do
info=`bluetoothctl info $uuid`
if echo "$info" | grep -q "Connected: yes"; then
echo "$info" | grep "Name"
fi
done
Run Code Online (Sandbox Code Playgroud)
小智 2
这可能会有所帮助:sudo bluetoothctl info MAC-ADDRESS-OF-DEVICE