Web lists-archives.com

Re: quick scripting 'is /P/Q mounted'

On Tue, Mar 13, 2018 at 07:51:32AM -0700, Mike McClain wrote:
> Thank you Richard.
> I suspect $(grep /south40/docs/ /proc/mounts) would be faster than

But that would be wrong, because it would incorrectly return "true"
if you have something mounted at /south40/docs/subdir or /media/south40/docs/
(or if there is a device that contains the string "/south40/docs/"
somewhere in its name, etc.).

Use the mountpoint command instead.  This is why it exists.  (Use the
-q option in a shell script to suppress the human-readable output.)