免费注册 查看新帖 |

Chinaunix

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

问个while循环问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-09-30 10:46 |只看该作者 |倒序浏览
bash的
while [ `wc ${dir}/vio.rpt | awk '{print $3}'` -le ${vio_size} ]
  do
    update_proc
  done

其中vio.rpt小于某个值时,运行更新程序
直到vio.rpt不小于这个值
更新程序会处理vio.rpt

vio_size为外部传进来的参数

这样写有问题吗?

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
2 [报告]
发表于 2010-09-30 10:55 |只看该作者
你自己无法测试?

论坛徽章:
0
3 [报告]
发表于 2010-09-30 11:04 |只看该作者
回复 2# Shell_HAT


    我测试的不对,但是我怀疑别的地方出了问题
所以想确认一下这个

论坛徽章:
0
4 [报告]
发表于 2010-09-30 11:22 |只看该作者
回复 3# HolySaint


    你这个wc ${dir}/vio.rpt | awk '{print $3}是干什么的呀?

论坛徽章:
0
5 [报告]
发表于 2010-09-30 13:47 |只看该作者
回复 4# 好看的附件
获得文件大小

论坛徽章:
0
6 [报告]
发表于 2010-09-30 14:34 |只看该作者
回复 5# HolySaint


   
WC(1)                                 FSF                                WC(1)

NAME
       wc - print the number of bytes, words, and lines in files


MS和你说的不一样

论坛徽章:
0
7 [报告]
发表于 2010-09-30 14:37 |只看该作者
没有问题

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
8 [报告]
发表于 2010-09-30 15:51 |只看该作者
回复 6# 好看的附件

也许楼主的wc跟你的不一样
wc - print newline, word, and byte counts for each file
dragon23452345 该用户已被删除
9 [报告]
发表于 2010-09-30 16:46 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
10 [报告]
发表于 2010-10-08 10:26 |只看该作者
  1. WC(1)                                                          User Commands                                                          WC(1)

  2. NAME
  3.        wc - print the number of newlines, words, and bytes in files

  4. SYNOPSIS
  5.        wc [OPTION]... [FILE]...

  6. DESCRIPTION
  7.        Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified.  With no FILE, or when FILE
  8.        is -, read standard input.

  9.        -c, --bytes
  10.               print the byte counts

  11.        -m, --chars
  12.               print the character counts

  13.        -l, --lines
  14.               print the newline counts

  15.        -L, --max-line-length
  16.               print the length of the longest line

  17.        -w, --words
  18.               print the word counts

  19.        --help display this help and exit

  20.        --version
  21.               output version information and exit

  22. AUTHOR
  23.        Written by Paul Rubin and David MacKenzie.

  24. REPORTING BUGS
  25.        Report bugs to <bug-coreutils@gnu.org>.

  26. COPYRIGHT
  27.        Copyright © 2004 Free Software Foundation, Inc.
  28.        This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS  FOR  A
  29.        PARTICULAR PURPOSE.
复制代码
我在找找别处,可能别的逻辑有问题
多谢大家哈
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP