我想编写一个bash脚本来通过ID来杀死一个进程,但我似乎无法让PID工作,因为它不断变化。为什么是这样?为什么grepping PID不断变化?
Jacks-MBP:~ Knof$ ps aux | grep "firefox"
Knof 515 0.0 4.3 4822060 723232 ?? U 10:28PM 4:57.15 /Applications/Firefox.app/Contents/MacOS/firefox
Knof 4489 0.0 0.0 2436888 812 s002 S+ 12:36AM 0:00.00 grep firefox
Jacks-MBP:~ Knof$ ps aux | grep "firefox"
Knof 515 0.0 4.3 4822060 723232 ?? U 10:28PM 4:57.15 /Applications/Firefox.app/Contents/MacOS/firefox
Knof 4491 0.0 0.0 2436888 812 s002 S+ 12:36AM 0:00.00 grep firefox
Jacks-MBP:~ Knof$ ps aux | grep "firefox"
Knof 515 0.0 4.3 4822060 723232 ?? U 10:28PM 4:57.15 /Applications/Firefox.app/Contents/MacOS/firefox
Knof 4493 0.0 0.0 2436888 812 s002 S+ 12:36AM 0:00.00 grep firefox
Jacks-MBP:~ Knof$ ps aux | grep "firefox"
Knof 515 0.0 4.3 4822060 723232 ?? U 10:28PM 4:57.15 /Applications/Firefox.app/Contents/MacOS/firefox
Knof 4495 0.0 0.0 2435864 800 s002 S+ 12:36AM 0:00.00 grep firefox
你打秒我...... ;-) –