由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - Help on shell script
相关主题
shell programming problems简单问题,可我不会。:( 急用啊!
question向高人请教:怎么从大量的文件中grep
[转载] Shell高手看过来。which shell is best?
一个Shell问题shell programming
[转载] shell programming and awk questionswhere can I find some good website for C Shell ?
求助:ps的参数Shell Script
How to test an empty string in shell为什么我就是不会写Shell script?
请教一个shell script的问题How to set environment variables for CGI scripts?
相关话题的讨论汇总
话题: shell话题: script话题: process话题: grep话题: ps
进入Unix版参与讨论
1 (共1页)
c********e
发帖数: 417
1
The shell script does the following:
if a certain process is not running, then start it.
I'm think of using 'ps-e|grep process', but I don't know how to test
if a string is empty.
Thanks.
d***c
发帖数: 21
2
there should be an easy way, but if you do 'ps -e|grep -c process', then you only need to check if the result is 0.

【在 c********e 的大作中提到】
: The shell script does the following:
: if a certain process is not running, then start it.
: I'm think of using 'ps-e|grep process', but I don't know how to test
: if a string is empty.
: Thanks.

B**z
发帖数: 153
3
if ps -e |grep -c process > /dev/null;then
# do something
fi

【在 d***c 的大作中提到】
: there should be an easy way, but if you do 'ps -e|grep -c process', then you only need to check if the result is 0.
1 (共1页)
进入Unix版参与讨论
相关主题
How to set environment variables for CGI scripts?[转载] shell programming and awk questions
how to convert csh shell script to dos batch file求助:ps的参数
a question in shell scriptHow to test an empty string in shell
Help! shell programming请教一个shell script的问题
shell programming problems简单问题,可我不会。:( 急用啊!
question向高人请教:怎么从大量的文件中grep
[转载] Shell高手看过来。which shell is best?
一个Shell问题shell programming
相关话题的讨论汇总
话题: shell话题: script话题: process话题: grep话题: ps