Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1548251
  • 博文数量: 1481
  • 博客积分: 26784
  • 博客等级: 上将
  • 技术积分: 17045
  • 用 户 组: 普通用户
  • 注册时间: 2011-07-12 09:22
文章分类

全部博文(1481)

文章存档

2014年(10)

2013年(353)

2012年(700)

2011年(418)

分类: IT业界

2011-07-27 09:08:39

折腾一晚上了,第一脚本终于写出来了
中途遇见点错误

  1. syntax error near unexpected token `do'

这个错误 就是因为我再windows下编写的 稍微的解决了下
可是问题还是出现,在高纪胜和叶学辉的帮助下 还是改正了 哈
我说下功能 这个主要写的是find 几个选项 通过文件大小 文件名 文件所有者 来搜索
希望各位同学能帮我再简化下脚本 3Q3Q了~
  1. #!/bin/bash
  2. #!this shell about user to search file!the search mode about filesize,filename,fileowner
  3. #!author:lamp30Q qindongsheng qq:229932704
  4. echo "my first shell,if the shellfile has errors,hope everybody to change"
  5. echo
  6. echo
  7. select mode in size name userfile
  8. do
  9. break
  10. done
  11. echo "pls input you want to search the DIR,"
  12. read sdir
  13. case $mode in
  14. size)
  15. echo "pls input the file Least size,For Exmple:100MB,you must input +204800"
  16. read fileleast
  17. echo "pls input the file Max size,For Exmple:100MB,you must input -204800"
  18. read filemax
  19. /usr/bin/find $sdir -size $fileleast -a -size $filemax
  20. ;;
  21. name)
  22. echo "pls input the filename as you want to search "
  23. read filename
  24. /usr/bin/find $sdir -name $filename
  25. ;;
  26. userfile)
  27. echo "pls input username as you wang to search file owner"
  28. read username
  29. /usr/bin/find $sdir -user $username
  30. ;;
  31. *)
  32. echo "input error"
  33. esac

原文地址:

阅读(314) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~