test.sh
#!/bin/bash
pid=`ps aux|grep -v grep|grep -v "test.sh"|grep $1|sed -n '1P' | awk '{print $2}'`
if [ -z $pid ] ;then
echo "there isn't this process!"
else
echo $pid
fi
pid=`ps aux|grep -v grep|grep -v "test.sh"|grep $1|sed -n '1P' | awk '{print $2}'`
if [ -z $pid ] ;then
echo "there isn't this process!"
else
echo $pid
fi
转载于:https://blog.51cto.com/weijia/119733