Why do you sometimes have two identical .sh files when you start them?

Why do you sometimes have two identical processes to start .sh files

clipboard.png


shell

clipboard.png

Mar.16,2021

pay attention to your sentence:

psNum=`ps -uxf|grep python|wc -l`

this sentence uses a pipeline, the execution will open the child shell, the child shell is the child process created by the main process fork, ps will see that the command line of the two processes is the same, in fact, these two processes are parent-child process relationship, you can see your ps print out these two processes, the PPID of the following process (the third column of the parent process PID,) happens to be the PID (column 2) of the above process, which can confirm this.

Menu