ps -ef | grep -v seemingly ineffective in shell sh script?

Original link: http://www.cnblogs.com/FlyAway2013/p/10858028.html

 

Want ps -ef | grep erdp_ | awk '{print $ 2}' erdp_ acquired at the beginning of the process id, execution is ok in a terminal environment, but sh script which turned out to be more out of the two

 

root 11400 4280 0 17:08 pts/5 00:00:00 /bin/bash ./kill.sh erdp_system_app

root 11401 11400 0 17:08 pts/5 00:00:00 /bin/bash ./kill.sh erdp_system_app

root 11403 11401 0 17:08 pts/5 00:00:00 grep erdp_system_app

root 29942 1 3 12:22 pts/0 00:10:10 java -Xms512m -Xmx512m -Dfile.encoding=UTF-8 -DSERVER_PORT=8082 -jar erdp_system_app-2.0.0-SNAPSHOT.war linkServerPId

ps -ef | grep erdp_ | awk '{print $ 2}' | grep -v can come to the third line, but the first two lines is how come from?

 

 

Anyway, enough with the following command:

ps -ef | grep erdp_ | grep -v | grep -v filename

or:

ps -ef | grep erdp_ | grep -ve '(grip | / bin / bash)'

 

ON. Posted 2019-05-13 17:47 CanntBelieve read ( ... ) Comments ( ... ) edit collections

Reproduced in: https: //www.cnblogs.com/FlyAway2013/p/10858028.html

Guess you like

Origin blog.csdn.net/weixin_30338497/article/details/94954954