我使用 procps-3.3.10 中的 pgrep。
如果我有可执行文件aout_abcdefgh_ver27
,那么
pgrep aout_abcdefgh_ver27
Run Code Online (Sandbox Code Playgroud)
不返回任何内容,而ps aux | grep aout_abcdefgh_ver27
返回预期结果:
ps aux | grep aout_abcdefgh_ver27
evgeniy 14806 0.0 0.0 4016 672 pts/8 S 12:50 0:00 ./aout_abcdefgh_ver27
evgeniy 15241 0.0 0.0 12596 2264 pts/8 S+ 12:50 0:00 grep --colour=auto aout_abcdefgh_ver27
Run Code Online (Sandbox Code Playgroud)
但如果我跑
$ pgrep aout_abcdefgh_v
14806
Run Code Online (Sandbox Code Playgroud)
pgrep
返回我期望的结果,所以我想知道为什么它以如此奇怪的方式工作,也许我应该使用一些选项pgrep
来处理完整的进程名称?
看起来它的模式限制很短,大约 10 个符号。