Web lists-archives.com

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




Thank you Richard.
I suspect $(grep /south40/docs/ /proc/mounts) would be faster than
$( mount | grep 'south40/docs').
And I'm sure [ -f /south40/docs/.flag ] would be.
Much obliged.
Mike

On Tue, Mar 13, 2018 at 05:37:07PM +1300, Richard Hector wrote:
> On 13/03/18 16:40, Mike McClain 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').
>
> You could look at /proc/mounts, but that's similar to the output of mount.
>
> Or if it's for a specific directory, and you can put something in it,
> you can test for the existence of a special file in the directory.
>
> Something like
>
> [ -f /south40/docs/.flag ]
>
> Richard
>
--
"Any intelligent fool can make things bigger and more complex...
It takes a touch of genius - and a lot of courage to move in the
opposite direction."                   - Albert Einstein