Hi all, i hava a specific backgroud process. I have de PID of this process. At some time, the process finish his job, is there any way to catch the exit code? I use "echo $?" normally for commands.
Thanks!
Hi all, i hava a specific backgroud process. I have de PID of this process. At some time, the process finish his job, is there any way to catch the exit code? I use "echo $?" normally for commands.
Thanks!
Have a look at wait
mute@clt:~$ { sleep 30; exit 123; } &
[1] 24619
mute@clt:~$ wait 24619
[1]+ Exit 123 { sleep 30; exit 123; }
mute@clt:~$ echo $?
123
of course, wait
blocks...
Use wait
wait <PID>
status=$?
EDIT: too late...