Quick bash script to check if a volume is mounted

A quick and dirty little bash script to check if a mount point is active or not.

if grep -qs '/mnt/drive1' /proc/mounts; then
    echo "It's mounted."
else
    echo "It's not mounted."
fi

You can easily change the code to automatically mount the volume (or unmount) as per your needs.

 
comments powered by Disqus