判断程序是否存在

使用下列代码判断程序sh test.sh是否在后台执行!

#!/bin/sh
count=`ps aux | grep -v grep | grep "sh test.sh" | wc -l`
echo $count
if [ $count -ge 1 ] ;
then
  echo "faild"
  exit
else
  sleep 40
fi
echo "end"

results matching ""

    No results matching ""