【发布时间】:2018-11-06 16:49:18
【问题描述】:
我正在为一个需要 lsusb 的设备 ID 在其配置中的程序编写安装脚本,因此我正在考虑执行以下操作:
$usblist=(lsusb)
#put the list into a array for each line.
#use the array to give the user a selection list usinging whiptail.
#from that line strip out the device id and vender id from the selected line.
抱歉,我的代码还没有走得太远,但我被困在这上面,不知道如何做我想做的事。请有人帮忙。我对 shell 脚本很陌生
【问题讨论】:
-
您是否尝试过在AskUbuntu 或Unix Stackexchange 上提问?因为那个真的绑定到操作系统(Linux)
-
不,我没有。我需要等待 40 分钟才能重新发布。我什至不知道如何正确地提出问题,以便人们能够理解我想要做什么
-
我一直在研究使用 sed,但无法弄清楚如何采用如下所示的线:“Bus 001 Device 004: ID 0665:5161 Cypress Semiconductor USB to Serial”和只删除这个:“0665:5161”
-
你试过
grep吗?如果我没记错的话它支持正则表达式..