typeset -i rc=`path_to_script [arg1 ...]` if [[ $rc -ne 0 ]]; then # exit appropriately fi
You might also want to liik at this: http://www.samag.com/documents/s=9238 /sam0408f/0408f.htm
-- ---- ---- ---- Ron Reidy Lead DBA Array BioPharma, Inc.
-- --Original Message-- -- From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]On Behalf Of Marquez, Chris Sent: Wednesday, August 31, 2005 9:11 AM To: oracle-l@(protected) Subject: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?
In my original quest for help I was working with one script. (btw with you help/code I did complete this task...works well, thanks!)
Now I have a new problem that I do not know how to deal with. I have a wrapper script involved this time.
Something like this;
===== imp_wrapper.sh ...
#RUN THIS SCRIPT script1.sh
#RUN THIS FUNCTION do func1
#RUN THE IMP SCRIPT imp_script.sh
#RUN THIS SCRIPT script2.sh
#RUN THIS FUNCTION do func2
# RETURN CODE: Set next Return Code. RC=$? echo 'RETURN CODE' >> $log_file 2>&1 echo $RC >> $log_file =====
My imp_script.sh has "trap" code and "RETURN CODE" syntax/value also in the script.
But I need to be able to STOP/EXIT/END the parent script; imp_wrapper.sh and set $?=1 when child scrip; imp_script.sh fails with RC=1?
Meaning if import.sh; RC=1, then I want imp_wrapper.sh; RC=1 immediately and exit?
This confuses me and I have no idea how to pass child (exit) RC to the parent script.
Thanks in advance,
Chris Marquez Oracle DBA
This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?</TITLE>
<META content="MSHTML 6.00.2800.1505" name=GENERATOR></HEAD> <BODY> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005>to trap the error code:</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005>typeset -i rc=`path_to_script [arg1 ...]`</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005>if [[ $rc -ne 0 ]]; then</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005>  ; # exit appropriately</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005>fi</SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005></SPAN></FONT> </DIV> <DIV><FONT face=Arial color=#0000ff size=2><SPAN class=962581515-31082005>You might also want to liik at this: <A href="http://www.samag.com/documents/s=9238/sam0408f/0408f.htm">http://www .samag.com/documents/s=9238/sam0408f/0408f.htm</A></SPAN></FONT></DIV> <DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV> <P><FONT face=Arial size=2>-- ---- ---- ----</FONT> <BR><FONT face=Arial size=2>Ron Reidy</FONT> <BR><FONT face=Arial size=2>Lead DBA</FONT> <BR><FONT face=Arial size=2>Array BioPharma, Inc.</FONT> <BR><FONT face=Tahoma><BR><FONT size=2><SPAN class=962581515-31082005><FONT face=Arial color=#0000ff> </FONT></SPAN>-- --Original Message-- --<BR><B>From:</B> oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]<B>On Behalf Of </B>Marquez, Chris<BR><B>Sent:</B> Wednesday, August 31, 2005 9:11 AM<BR><B>To:</B> oracle-l@(protected)<BR><B>Subject:</B> PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?<BR><BR></FONT></FONT></P><!-- Converted from text/plain format --><BR> <P><FONT size=2>In my original quest for help I was working with one script.<BR>(btw with you help/code I did complete this task...works well, thanks!)<BR><BR>Now I have a new problem that I do not know how to deal with.<BR>I have a wrapper script involved this time.<BR><BR>Something like this;<BR><BR>=====<BR>imp_wrapper.sh<BR>...<BR><BR>#RUN THIS SCRIPT<BR>script1.sh<BR><BR>#RUN THIS FUNCTION<BR>do func1<BR><BR>#RUN THE IMP SCRIPT<BR>imp_script.sh<BR><BR>#RUN THIS SCRIPT<BR>script2.sh<BR><BR>#RUN THIS FUNCTION<BR>do func2<BR><BR># RETURN CODE: Set next Return Code.<BR>RC=$?<BR>echo 'RETURN CODE' >> $log_file 2>&1<BR>echo $RC >> $log_file<BR>=====<BR><BR>My imp_script.sh has "trap" code and "RETURN CODE" syntax/value also in the script.<BR><BR>But I need to be able to STOP/EXIT/END the parent script; imp_wrapper.sh and set $?=1 when child scrip; imp_script.sh fails with RC=1?<BR><BR>Meaning if import.sh; RC=1, then I want imp_wrapper.sh; RC=1 immediately and exit?<BR><BR>This confuses me and I have no idea how to pass child (exit) RC to the parent script.<BR><BR>Thanks in advance,<BR><BR>Chris Marquez<BR>Oracle DBA<BR></FONT></P></BODY><P align=left style="MARGIN-RIGHT: 0px"><FONT face=Tahoma size=2><FONT color=#0000ff> <HR> </FONT></FONT><FONT face=Tahoma size=2><FONT color=#0000ff>This electronic message transmission is a PRIVATE communication which contains information <BR >which may be confidential or privileged. The information is intended to be for the use of the individual <BR>or entity named above. If you are not the intended recipient, please be aware that any disclosure, <BR>copying, distribution or use of the contents of this information is prohibited. Please notify the sender <BR>of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), <BR>and then delete it from your system.</FONT></FONT></P></HTML>