📌  相关文章
📜  查找 ubuntu usb 端口 tty - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:06.503000             🧑  作者: Mango

代码示例1
#!/bin/bash

for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
    (
        syspath="${sysdevpath%/dev}"
        devname="$(udevadm info -q name -p $syspath)"
        [[ "$devname" == "bus/"* ]] && exit
        eval "$(udevadm info -q property --export -p $syspath)"
        [[ -z "$ID_SERIAL" ]] && exit
        echo "/dev/$devname - $ID_SERIAL"
    )
done