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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM