Total Pageviews

Friday, 18 December 2015

shell中的if脚本

语法:
if [ condition ]
then
   statements for when the condition is true
else
   statements for when the condition is false
fi
实例,判断一个文本中是否包含ret
if [ $`cat /tmp/erlogret.txt |grep "ret"` ]
    then
        echo "any web application is ok"
    else
        echo "some web application is error,please call jackzou"
fi