免费注册 查看新帖 |

Chinaunix

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

Ps -ef|grep process1 |wc的疑问 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-06-03 10:14 |只看该作者 |倒序浏览
本想控制只有10用户能够用process1进程的应用,但是发现用ps -ef|grep process1 |wc 取得现在使用的数目是出现三种数据:
jones#/home/jones/script>;ps -ef | grep qad |wc
22 250 2346
但是只想取得22,请问怎么会出现三组数据呢,不太能够明白!

论坛徽章:
0
2 [报告]
发表于 2003-06-03 10:19 |只看该作者

Ps -ef|grep process1 |wc的疑问

wc -l

If no option is specified the default is -lwc (count  lines,
words, and bytes.)

论坛徽章:
0
3 [报告]
发表于 2003-06-03 10:29 |只看该作者

Ps -ef|grep process1 |wc的疑问

Thanks!
but the second solutions -lwc is not correct.

原帖由 "sql2000" 发表:
wc -l

If no option is specified the default is -lwc (count  lines,
words, and bytes.)

论坛徽章:
0
4 [报告]
发表于 2003-06-03 10:32 |只看该作者

Ps -ef|grep process1 |wc的疑问

Thanks!
but the second ways ' -lwc ' is not correct.

论坛徽章:
0
5 [报告]
发表于 2003-06-03 10:33 |只看该作者

Ps -ef|grep process1 |wc的疑问

兄弟,你的英语不好吧.     

我下面的那句话是解释为什么会出现3个结果。
欢迎常来这里。     

论坛徽章:
0
6 [报告]
发表于 2003-06-03 11:10 |只看该作者

Ps -ef|grep process1 |wc的疑问

我明白了!!!
哈哈,是那话都没有看懂呢?

论坛徽章:
0
7 [报告]
发表于 2003-06-03 12:47 |只看该作者

Ps -ef|grep process1 |wc的疑问

我也明白了
不过你要控制只有10个用户成功了没有啊
你怎么做的啊
这个还是不明白

论坛徽章:
0
8 [报告]
发表于 2003-06-03 14:10 |只看该作者

Ps -ef|grep process1 |wc的疑问

我是想这样做: 在用户的profile里加一限制,如果ps -ef | grep qad|wc -l >;10那么就exit.用户就被迫退出HP-UX系统!
     但发现unix的script真是难记.
number='ps -ef | grep qad|wc -l'
if "$number" <= "10"
then

  echo " Already has 10 users in QAD"
  exit
fi
但执行起来却不行!

论坛徽章:
0
9 [报告]
发表于 2003-06-03 14:50 |只看该作者

Ps -ef|grep process1 |wc的疑问

??

论坛徽章:
0
10 [报告]
发表于 2003-06-03 16:46 |只看该作者

Ps -ef|grep process1 |wc的疑问

I see! I can use < or >; in unix script.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP