Hi,
I'm trying to query the output of
mount to verify that a given argument is really a btrfs mount point and return the actual device name. For instance:
# mount | grep /mnt/0 | grep btrfs | awk '{print $1}'
/dev/sda3
The above works fine. But fails when the argument is e.g. /mnt, which exists, but is not a mount point. Trying to match the whole word using -w does not work. For instance:
# mount | grep -w /mnt
/dev/sda3 on /mnt/root type btrfs (rw,seclabel,relatime,space_cache)
/dev/sda3 on /mnt/258 type btrfs (rw,seclabel,relatime,space_cache)
/dev/sda3 on /mnt/0 type btrfs (rw,seclabel,relatime,space_cache)
Unfortunately the above returns 3 matches, although /mnt isn't a mount point.
I could use
mountpoint and perhaps other methods, but I wonder if there is perhaps just a simple change required to make grep consider the forward slash as part of a word.
Any ideas?
Thanks.