I know I can get process id of the main shell by $$
, but how do you get PID of subshell created by e.g. ( ... )
from within the block?
Asked
Active
Viewed 368 times
-1

jarno
- 620
(pid=$(exec sh -c 'echo "$PPID"'); echo "$$ $pid")
. See https://unix.stackexchange.com/a/484464/40484 – Paulo Tomé Mar 18 '20 at 18:25