1

I executed bash -c "ps && ps" and got the following output:

  PID TTY          TIME CMD
25544 pts/0    00:00:00 bash
26562 pts/0    00:00:00 bash
26563 pts/0    00:00:00 ps
  PID TTY          TIME CMD
25544 pts/0    00:00:00 bash
26562 pts/0    00:00:00 ps

And I'm confused why is the PID of last ps the same as the PID of bash which spawned it (26562).

This seems to always affect the last command (if I have 3 commands given to bash then the first 2 have different PIDs and and last reuses the bash one).

Shouldn't the PIDs be different and shouldn't I be able to see it this behavior only if I prefix it with exec?.

user1335014
  • 163
  • 1
  • 1
  • 4

0 Answers0