免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2737 | 回复: 1
打印 上一主题 下一主题

讨论一下:mount 时会不会提示本地目录已经mount了一个了? [复制链接]

论坛徽章:
0
1 [报告]
发表于 2004-02-24 14:06 |显示全部楼层

讨论一下:mount 时会不会提示本地目录已经mount了一个了?

那为什么不多建一个目录呢?

论坛徽章:
0
2 [报告]
发表于 2004-02-24 23:32 |显示全部楼层

讨论一下:mount 时会不会提示本地目录已经mount了一个了?

试试这个脚本。

  1. #!/bin/bash
  2. #
  3. #Name : MyMount
  4. #Author : PopZslam
  5. #Descript : To avoid mount a device twice or more
  6. #
  7. #---------------
  8. _MOUNTTABLENOPATH=`mount|awk -F"/" '{ print $3; }'`
  9. _MOUNTTABLED=`mount|awk '{ print $3"/"; }'`

  10. # Check if the device is used or not.
  11. # If you needn't the path
  12. echo "$_MOUNTTABLENOPATH"|grep $1 1>;/dev/null
  13.         if [ $? -eq 0 ] ; then
  14.         printf "\n\tThe device that you want mount is USED !\n\n"
  15.         exit 0
  16.         fi
  17. # Check if the directory is used or not.This situation will effect
  18. # when you want to mount a floppy disk or a CD device.
  19. echo $_MOUNTTABLED|grep $1 1>;/dev/null
  20. if [ $? -eq 0 ] ; then
  21.         printf "\n\tThe directory that you want mount is USED !\n\n"
  22.         exit 0
  23. fi
  24. # Check if the directory is used or not.
  25. echo $2|grep "mnt" 1>;/dev/null
  26. if [ $? -eq 0 ] ; then
  27.         echo $_MOUNTTABLED|grep $2 1>;/dev/null
  28.         if [ $? -eq 0 ] ; then
  29.         printf "\n\tThe directory that you want mount is USED !\n\n"
  30.         exit 0
  31.         fi
  32. fi

  33. # Exec the command
  34. mount $1 $2

  35. #------------------
  36. #End
复制代码


如在使用时有问题请指正!
想再简化些,可是不会了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP