shell判断USB接口是否有设备插入

#/bin/sh

usb_num=$(cat /proc/scsi/scsi | grep "Vendor" | wc -l)
if [ $usb_num = 2 ];then
    echo "test usb success"
else
    echo "test usb failed"
fi
判断USB接口是否有设备插入,usb_num为检查到的USB设备个数。

posted @ 2019-01-31 21:20  leo21sun  阅读(2171)  评论(0编辑  收藏  举报