非root用户下执行
netstat -apn | grep 9990 | wc -l
结果为
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
0

为了单独获取最后一个数字,可以

port_count=`netstat -apn 2> /dev/null |grep 9990 |wc -l`

posted on 2015-11-19 18:02  凌度  阅读(686)  评论(0)    收藏  举报