A script I am writing on works on the DVD present in the drive at time of script execution. I want to extract merely the label of whatever appears after '/media/';
./script.sh /media/DVDRW-43/
An obvious solution would be to get the substring by
path='echo ${file:7:9}' #renders DVDRW-43
but I would rather a substring extraction based on capturing from the second occurence of '/' to third occurence of '/'. I can't get my head around regex or the substring commands to do this.