rbrito / usbmount

Simple set of scripts to automount removable devices for a Linux system
274 stars 88 forks source link

UUID matching in /etc/fstab doesn't work #18

Open ColinTaylorUK opened 5 years ago

ColinTaylorUK commented 5 years ago

https://github.com/rbrito/usbmount/blob/9a92e7d622662380f4329e0db17e263509715722/usbmount#L109

This change breaks UUID matching in /etc/fstab on Ubuntu 18.04.1 (and probably most other OS).

The problem is that it tries to match using "? but ? is not a basic regular expression (BRE) metacharacter. ? is an extended regular expression (ERE) metacharacter so grep needs the "-E" parameter as follows:

elif egrep -q "^[[:blank:]]*UUID=\"?$UUID\"?" /etc/fstab; then

It will now work.

EDIT: Changed "grep -E" to "egrep" to be consistent with the rest of the code.