![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's | manas6 | UNIX for Dummies Questions & Answers | 0 | 06-05-2008 07:44 AM |
| sendmail return code | trichyselva | Shell Programming and Scripting | 0 | 04-02-2008 08:20 AM |
| asking about return code | naamas03 | Shell Programming and Scripting | 3 | 08-28-2007 05:53 AM |
| Return Code of tar in AIX | dupeng | AIX | 3 | 02-23-2004 12:05 AM |
| return code from oracle | lesstjm | Shell Programming and Scripting | 3 | 01-29-2002 03:50 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Incorporte Return Code
I am writing a script to call sql script and thus caputure few return type.
here is the script: Code:
echo "Checking for Loader Status " >> $REPFILE
if test $? = 0
then
echo "Successful termination of SQL*Loader "$LOADER1 >> $REPFILE
grep "successfully loaded." $LOGDIR/$LOADER1.log >> $REPFILE
else
echo "Loader has some problems " >> $REPFILE
PROBLEMS=1
fi
if test $PROBLEMS = 1
then
echo "\nUnsuccessful termination of" $SCRIPT >> $REPFILE
exit 1
else
echo "\n----------------------------------" >> $REPFILE
echo "Successful termination of" $SCRIPT >> $REPFILE
echo "----------------------------------" >> $REPFILE
fi
exit 0
but I need to create few more like HTML Code:
0 echo "SQL*Loader execution successful" ;; 1 echo "SQL*Loader execution exited with failure, see logfile" ;; 2 echo "SQL*Loader execution exited with warning, see logfile" ;; 3 echo "SQL*Loader execution encountered a fatal error" ;; * echo "unknown return code";; 1,,2,3, * but unable to proceed.tried for 1 also but fails . The code works fine with 0 Can anyone provide input how to create and construct other conditions. |
|
||||
|
write a function
Write a function like check_status and pass the return code as a variable. Inside the function, use case syntax
Code:
function check_status
{
ret_code=$1
case $ret_code in
0) ....
break;;
1) ....;
break;;
*) --default action here;
esac;
}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|