(I'm assuming you're writing a bash script on a Linux system)
if grep -qs '/foo/bar' /proc/mounts; then
echo "/foo/bar mounted"
echo "/foo/bar not mounted" return 1 || exit 1
Put these commands below the shebang but before the start of the script. I hope this helps you!
Edit: I added a crapload of newlines to better show the indentation and newlines required for the script to work. Sorry it's ugly
(I'm assuming you're writing a bash script on a Linux system)
if grep -qs '/foo/bar' /proc/mounts; then
else fiPut these commands below the shebang but before the start of the script. I hope this helps you!
Edit: I added a crapload of newlines to better show the indentation and newlines required for the script to work. Sorry it's ugly