The search results that I've turned up have either been about determining whether a filesystem is mounted at a particular path or whether a particular path is being used as a mount point. I am looking for a way to determine whther or not a given device or file (i.e., a filesystem image) is mounted at all. This solution should be able to handle spaces in the path to device/file.
These, which I have seen in my search results, are NOT solutions:
mountpoint -q "${PATH}"
only tests if${PATH}
is a mount point.- Applying
grep -q "${PATH}"
to some output may not work because${PATH}
may have spaces in it and the output of commands likemount
has spaces in it.
Additionally, it should return WHERE a file/device is mounted to.
/home/user/fs
, but another file/device is mounted at/home/user/fs_mnt
, thengrep
is pretty useless./home/user/fs
is a device name…