You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riskshell/shell/findPortPid

8 lines
154 B

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