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
原文地址:https://www.cnblogs.com/cheyunhua/p/11377599.html