Finding number of child processes

Viewed 17080

How do find the number of child processes of a bash script, from within the script itself?

6 Answers

If job count (instead of pid count) is enough I just came with a bash-only version:

job_list=($(jobs -p))
job_count=${#job_list[@]}
Related