Linux 根据进程名字获取PID #!/bin/sh PID=$(ps | grep "name" | grep -v grep | awk '{print $1}') echo "PID=" $PID name时要查找的进程名字。