#! /bin/bash # process-monitor.sh process=$1 pid=$(ps -ef | grep $process | grep '/bin/java' | grep -v grep | awk '{print $2}') echo $pid
Bash Shell 获取进程 PID
© 2017, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com
#! /bin/bash # process-monitor.sh process=$1 pid=$(ps -ef | grep $process | grep '/bin/java' | grep -v grep | awk '{print $2}') echo $pid
© 2017, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com