
我在在線閃存卡中讀到該命令是:
pkill -u bob $(pgrep -u bob)
然而,我認為這是錯誤的。我認為它是在說:
殺死 擁有的所有已處理進程
bob
,並且4572\n4600
因為:
[bob@localhost ~]$ pgrep -u bob
4572
4600
此外,它也給出一個錯誤:
[bob@localhost ~]$ pkill -u bob $(pgrep -u bob)
pkill: only one pattern can be provided
Try `pkill --help' for more information.
這是有道理的,因為用戶名中不能有換行符,對吧?
我認為命令應該只是:
pkill -u bob
“殺死 bob 擁有的所有進程”
而命令:
pgreg -u bob
給出“bob 擁有的所有進程”
我在想:
- 我是否按預期使用了正確的命令?
- 我對錯誤方式的分析準確嗎?
答案1
你是對的
錯誤的: pkill -u bob $(pgrep -u bob)
正確的:pkill -u bob
閃存卡可能旨在顯示:
kill $(pgrep -u bob)
這將殺死 . 返回的所有進程pgrep -u bob
。