|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Catch exit code of specific background process
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! |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Have a look at
wait Code:
mute@clt:~$ { sleep 30; exit 123; } &
[1] 24619
mute@clt:~$ wait 24619
[1]+ Exit 123 { sleep 30; exit 123; }
mute@clt:~$ echo $?
123of course, wait blocks... |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Use
wait Code:
wait <PID> status=$? EDIT: too late... |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Catch Zombie Process | ckwan | AIX | 1 | 11-03-2011 04:36 AM |
| Background process, return code and pid. | RECrerar | Shell Programming and Scripting | 5 | 08-13-2011 05:30 AM |
| catch a particular word from a specific line -perlscript | pspriyanka | Shell Programming and Scripting | 2 | 06-15-2011 01:03 AM |
| Return code of background process | c19h28O2 | Shell Programming and Scripting | 3 | 04-06-2008 11:46 AM |
| background process return code | Vikas Sood | Shell Programming and Scripting | 5 | 06-10-2006 09:25 AM |
|
|