$cat t.sh
grep "12" test | wc -c
I want to know how many processes will be created when it runs.
I used
./t.sh;ps -aux | grep "t.sh"
but it didn’t work because “./t.sh” had run over when ps was working.
How can I reach this goal?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depends on the system you are running on. If you have
straceyou can trace all theforksystem calls. problem is though that somesystems usefork, somevforkand someclone, you will have to experiment. On linux:should give you a summary.
-cgives a count,-fmeans “follow” child processes, and-evforkmeans trace thevforkkernel call. The output goes to stderr, but you can redirect it to a file using the-ooption (there are some neat tricks you can do if you specify a named pipe here).