Visit Our UNIX and Linux User Community


hi all


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers hi all
# 1  
Old 07-12-2001
hi all

How can I capture the return value(success or failure) of the background process from the shellscript?
I have to submit multiple instances of same process in background!!
thanks
reddybSmilie
# 2  
Old 07-12-2001
Hi !

you can use the following example:

#!/bin/csh
your command
if ( $status != 0 ) then
echo "error"
exit 10
else
echo "command ok"
endif

or

#!/bin/ksh
your command
if [ $? -ne 0 ]
then
echo "error"
exit 10
else
echo "command ok"
fi


Note : Donīt use these scripts with remote shell (rsh / remsh).

I wait to have helped.

[]īs
Witt
witt
# 3  
Old 07-13-2001
Hi,
Will the $? be equal to 0 even for the command(Process) submitted in background with '&' ?
If you submit in bg the prompt wll be back with the status 0 as the latest command(submitting in BG) is success!
Is there any way that I can get the exit status of the process running in bg??

I hope this explains my problem!

thanks
REddyb
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #551
Difficulty: Medium
If variable i has the value 10, after x = 5 + (i++); the value of x after this code is 15.
True or False?

Featured Tech Videos