pid=`ps -ef|grep deploy|egrep -v 'grep'|awk -F '[ ]+' '{print $3}'` if [ $pid -ne 0 ] then kill $pid fi
上面脚本执行报错"[: =: unary operator expected"
需要把[ $pid -ne 0 ] 改为"[[ $pid -ne 0 ]]"即可
pid=`ps -ef|grep deploy|egrep -v 'grep'|awk -F '[ ]+' '{print $3}'` if [ $pid -ne 0 ] then kill $pid fi
上面脚本执行报错"[: =: unary operator expected"
需要把[ $pid -ne 0 ] 改为"[[ $pid -ne 0 ]]"即可