[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash usage.

On 5 November 2017 at 04:55,  <peter@easthope.ca> wrote:

> What about checking whether the
> filesystem of a specific device is mounted at that directory?  Can
> that be checked easily?

It can be done by inspecting the output of the 'mount' command.
But keep in mind that the detail of this output may not be stable
between versions of mount, or other factors that might change
its content, such as releases of operating systems.

Demo example from an interactive bash command line on this PC:

$ devname=/dev/sda6 ; dirname=/mnt/p/A ; if mount | grep -q --
"$devname on $dirname" ; then echo "$devname is mounted on $dirname" ;
/dev/sda6 is mounted on /mnt/p/A

Reply to: