Rul*_*ent 2 linux bash grep kill ps
me@me:~$ ps aux | grep -i firefox
me 15413 0.0 0.0 14428 1036 pts/1 S+ 05:46 0:00 grep --color=auto -i firefox
me@me:~$ kill 15413
bash: kill: (15413) - No such process
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况,或者我做错了什么?
看到是什么过程了吗?
me 15413 0.0 0.0 14428 1036 pts/1 S+ 05:46 0:00 grep --color=auto -i firefox
~~~~
Run Code Online (Sandbox Code Playgroud)
是它grep本身,当你得到提示时它已经完成了,所以没有什么可以杀死的。使用psgrep在运行过程中进行搜索,或至少使用了“方括号中的第一个字符”招
ps aux | grep -i '[f]irefox'
Run Code Online (Sandbox Code Playgroud)
从匹配中排除 grep。
| 归档时间: |
|
| 查看次数: |
4058 次 |
| 最近记录: |