#!/bin/bash # Mountpoint for volumes MOUNTPOINT="$HOME/unidades" for f in $(ls -1 $MOUNTPOINT) ; do RESULT=$(ls -1 $MOUNTPOINT/$f | wc -w ) if [ $RESULT -eq 0 ] ; then umount $MOUNTPOINT/$f || true fi done exit 0