打赏

shell脚本报错:"[: =: unary operator expected"

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 ]]"即可

posted @ 2019-07-01 11:31  芹溪  阅读(4630)  评论(0编辑  收藏  举报