Nixgeek

Random Ramblings

Thu 20 August 2015

Quick bash script to check if a volume is mounted

Posted by Daevien in tips   

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