比如查看ps -ef|grep random|grep -v grep是否执行成功 if [[ $? -eq 0 ]];then echo success else echo failed exit 1 fi