If, in bash, I execute:cmd1 | cmd2 | ... | cmdi | ... | cmdn &where the cmd{1..n} may not be distinct, how do I get the PID of cmdi? Alternatively, how can I signal the cmdi process? (For example, send it SIGUSR1?)pkill/pgrep, pidof etc. don't look like good answers, since other instances of cmdi maybe running, including as part of the same pipeline. jobs -p gives the PID of cmd1, for me. i can be anything in {1..n}.
Get PID of any command in backgrounded piped sequence of commands
bash;shell;pipe;job control