I have a tmpfs file system mounted on a particular directory. I want to write a shell script to check whether the tmpfs filesystem is already mounted on the directory.
There's a tool specifically for this: mountpoint(1)
if mountpoint -q "$directory" ; then
echo it is a mounted mountpoint
else
echo it is not a mounted mountpoint
fi
And you don't even have to scrape strings to do it!
Note that I find this tool in Debian's initscripts package. How available it is elsewhere is not something I can comment on.