#!/bin/sh # 查找端口pid port=`netstat -antpl|grep $1|awk '{printf $7}'|cut -d/ -f1` if [[ $# == 1 && `echo $port|wc -l` -eq 1 ]] then echo $port fi