I know in bash we can create subshells using round parenthesis ( and ). As per bash man page:
(
)
(list) list is executed in a subs
This seems like it works:
(echo $$; echo `ps axo pid,command,args | grep "$$" |awk '{ getline;print $1}'`) 14609 17365
For whatever reason, OSX is limited and doesnt come with pgrep, or one could do (which works in Linux):
(echo $$; echo `pgrep -P $$`) 14609 17390