!
shell variable holds the PID of the last executed command.
long-process &
[1] 589
Access it as $!
:
echo $!
Assign it to a variable:
long-process & export LONG_PROCESS_PID=$!
My Tech Newsletter
Get emails from me about programming & web development. I usually send it once a month