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

方法1:

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

方法2:

  1. if mountpoint -q /mnt/foo
  2. then
  3. echo "mounted"
  4. else
  5. echo "not mounted"
  6. fi
posted @ 2019-08-19 15:50  技术颜良  阅读(3881)  评论(0编辑  收藏  举报