I am working on an install script for a program that needs the device id from lsusb in it's configuration so I was thinking of doing the following:
$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.
Sorry I haven't gotten very far with my code but I am stuck on this and have no idea how to do what I would like to do. Please can someone help. I am very new to shell scripting
To extract the device IDs from
lsusb
, the following line can be used:If you need to store the IDs within an array, use the line below:
Accessing the first element in the
device_ids
array:echo ${device_ids[0]}