On Thu, Aug 13, 2026 at 12:44:04PM +0200, Jan Stary wrote:
> On Aug 12 15:43:36, [email protected] wrote:
> > # Adjust permissions for /tmp if it is on an mfs filesystem
> > /bin/df -t mfs /tmp/ > /dev/null 2> /dev/null && { echo "/tmp on mfs, 
> > setting permissons to 1777" ; chmod 1777 /tmp/ ; }
> 
> It's a pitty that mount -s does not accept -t as well,
> as in "mount -s -t mfs /tmp"; I assume that's why you call df.
> Is there a more elegant way to check if a given filesystem type
> is mounted on the given dir (besides parsing the textual output
> of course, as in mount -s | grep -F 'on /tmp type mfs')?

If you do decide to parse the output of mount -s in the way you suggest, be
aware that stacked mounts could easily give you a false positive.

I.E. if you have /tmp mounted as an mfs, then mount a disk-based ffs partition
over it, your command will still match it as being mfs.

This is one advantage of using df, it handles the stacked mount edge-case.

>From the shell, I'm not aware of a more elegant way of doing this.

Reply via email to