I'm writing a bash script that needs to detect when a usb storage device is inserted and assign it to a variable that would otherwise, typically look something like:
I have a few abstract ideas that involve using
watch, some kind of
while looping construct, and possibly
lsblk -o kname /
lsblk -o pkname; but am yet to fully realize anything suitable.
How best could I implement this?