They are examples of parameter substitution in bash. The first one means "strip the longest part of the pattern that matches the front end of the variable":
suppose the
$device variable is /dev/sdd. The pattern is
*/. Hence everything before the last slash (included) is removed from the string (leaving just the sdd part). Regarding the
$ sign at the end of the grep pattern, it means "at the end of the line".
The second one means "strip the longest part of the pattern that matches the back end of the variable":
Code:
${long_name%%_[0-9]*}
this strip the last part of the string
$long_name from the first underscore that comes immediately before a digit (not a character), that is the part in red:
Code:
usb-SanDisk_uSSD_5000_20052444330A224035EA-0:0
Hope it is clear now.
Reference:
http://www.tldp.org/LDP/abs/html/par...stitution.html