I would like to report the grand child process id to the parent either by storing it in a variable and exporting it or some other means. How is it possible? Below a small example.
example .
parent.sh
./child.sh &
wait
sleep 10
echo $grandchild_pid
child.sh
./grandchild.sh &
export grandchild_pid=$!