Last active
March 19, 2020 10:24
-
-
Save dniklaus/280ac7775b1ed7db91725b5fb8c4066b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -a usbpath | |
usbpath=($( lsusb | grep STM )) | |
bus=$( echo ${usbpath[1]} ) | |
dev=$( echo ${usbpath[3]} | cut -d ':' -f1 ) | |
#compose similar devpath=/dev/bus/usb/001/015 | |
devpath="/dev/bus/usb/${bus}/${dev}" | |
echo | |
if [[ "${usbpath[*]}" == "" ]] ; then | |
echo "no ST-LINK device found" | |
else | |
echo ${devpath} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment