Linux 通过程序名获取进程ID并Kill #!/bin/bash pids=$(ps -ef | grep XXX| awk '{print $2}') for pid in $pids do echo $pid kill -9 $pid done