[30期] 我的第一个shell脚本~感谢其他几位同学帮助

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

  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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值