Shell脚本检测文件夹是否已被挂载的方法

方法1:

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

 

方法2:

if mountpoint -q /mnt/foo 
then
   echo "mounted"
else
   echo "not mounted"
fi
posted @ 2016-12-02 09:08  Waichung  阅读(2511)  评论(0编辑  收藏  举报