我一生都无法弄清楚为什么pgrep
不返回我的进程的PID。然后,在最后一次徒劳的尝试中,我只输入了可执行文件名称的一部分,瞧,就是 PID。这导致了这个实验:
bash-4.1$ ./test_abcde_12345_vwxyz_67890.sh &
bash-4.1$
bash-4.1$ ps -ef | grep test_abcde_12345_vwxyz_67890
me 16695 21716 0 06:04 /root/dev/pts/2 00:00:00 /bin/bash ./test_abcde_12345_vwxyz_67890.sh
me 16945 22027 0 06:04 /root/dev/pts/3 00:00:00 grep test_abcde_12345_vwxyz_67890
bash-4.1$ pgrep test_abcde_12345_vwxyz_67890
bash-4.1$ pgrep test_abcde_12345_vwxyz_6789
bash-4.1$ pgrep test_abcde_12345_vwxyz_678
bash-4.1$ pgrep test_abcde_12345_vwxyz_67
bash-4.1$ pgrep test_abcde_12345_vwxyz_6
bash-4.1$ pgrep test_abcde_12345_vwxyz_
bash-4.1$ pgrep test_abcde_12345_vwxyz
bash-4.1$ pgrep test_abcde_12345_vwxy
bash-4.1$ pgrep test_abcde_12345_vwx
bash-4.1$ pgrep test_abcde_12345_vw
bash-4.1$ pgrep test_abcde_12345_v
bash-4.1$ pgrep test_abcde_12345_
bash-4.1$ pgrep test_abcde_12345
bash-4.1$ pgrep test_abcde_1234
16695
bash-4.1$ pgrep test_abcde_123
16695
bash-4.1$ pgrep test_abcde_12
16695
bash-4.1$ pgrep test_abcde_1
16695
bash-4.1$ pgrep test_abcde_
16695
bash-4.1$ pgrep test_abcde
16695
我在手册页中找不到这种行为。这是正常的吗?为什么它会这样工作?