Re: quick scripting 'is /P/Q mounted'
- Date: Tue, 13 Mar 2018 22:33:43 +0900
- From: Mark Fletcher <mark27q1@xxxxxxxxx>
- Subject: Re: quick scripting 'is /P/Q mounted'
On Tue, Mar 13, 2018 at 08:49:58PM +1100, David wrote:
> On 13 March 2018 at 14:40, Mike McClain <mike.junk.46@xxxxxxx> wrote:
> > If my other computer is South40 and I want to mount South40's /docs
> > on my /south40/docs/ directory I can do that. As one script calls
> > another I want to know if I need to mount South40 without
> > $( mount | grep 'south40/docs').
> > Suggestions?
> Installing the package util-linux will provide the mountpoint command
> which exits true=0 if its argument is in use as a mountpoint. Example:
> $ if mountpoint / ; then echo "exit status is $?" ; fi
> / is a mountpoint
> exit status is 0
Unless I've misunderstood the question, you can tell if something is
mounted at a mount point by checking if anything is present under the
mount point, eg if you know there is a directory /Y that gets mounted
under mount point /X, you can can make sure /X/Y doesn't exist under the
mount poiunt and then check for the existence of /X/Y -- it will be
there if the mount point is in use and not if not.