How to get the pid of the last executed command in shell script?
I intend to have a shell manuscript similar to this:
my-app & echo $my-app-pid
But I do not recognize just how the get the pid of the simply implemented command.
I recognize I can simply make use of the
jobs -p my-app command to grep the pid. Yet if I intend to execute the shell numerous times, this method will certainly not function. Due to the fact that the jobspec is unclear.