LoveUnix » 编程开发 & Rational » 求教一个shell语句的写法
让LU留住您的每

一天 让LU博客留住您的每一天
2006-9-6 10:00 liufei134
求教一个shell语句的写法

小弟有一个程序,输入 jgpctl status命令,
若jgpctl已经启动,则显示
System is started.

Progress status:
jgpdsnr_s         pid = 450788        running
jgpevnt_s         pid = 438500        running
jgpsch              pid = 458976         running


若jgpctl未启动,则显示
System not started yet.


各位大侠,我想写一个SHELL,调用jgpctl status命令,然后想通过屏幕显示的第一行的区别来判断进程是否启动,往不吝赐教!!

2006-9-6 14:12 meteor06
if [ $(jgpctl status|head -n 1) = "System is started" ]
then
  echo start
else ...
fi
btw:你都能用jgpctl status取状态,却需要再用shell来判断 :o

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.