sh12345678910111213#!/bin/bashport=8080 # 将8080替换成你想要查找和杀死的端口号# 查找端口的进程IDpid=$(lsof -ti :$port)# 杀死进程if [[ -n "$pid" ]]; then echo "Killing process $pid listening on port $port" kill -9 $pidelse echo "No process listening on port $port"fi