![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Terminal And Cron Job Return Different Status Code | isaac_ho | Shell Programming and Scripting | 1 | 06-02-2008 12:12 AM |
| Return of EXIT status ( $? ) | ZINGARO | HP-UX | 1 | 03-12-2008 07:07 AM |
| Verify scp return status | new2ss | Shell Programming and Scripting | 2 | 06-28-2006 10:04 PM |
| Return status of all previous runs | mpang_ | Shell Programming and Scripting | 4 | 06-27-2006 02:58 AM |
| return ftp status | blt123 | Shell Programming and Scripting | 12 | 07-21-2005 05:48 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hello there!
Here is my problem. I hope I can get some help about it. I need to know how can I get the return code of an application in the Unix shell script. The script is like below: PREVIOUS STATEMENT & VARIABLES sqlplus scott/tiger @$sqldir/$sqlscript NEXT STATEMENT (Like status=$?) If for some reason sqlplus (Oracle client application for making a connection to Oracle or run a PL/SQL script against Oracle) craps out, script will stop running, but, It does not return to the next statement after sqlplus... I've already tried "$?" to capture the return code but as I said the next statement after sqlplus never be reached.... I run the script using nohup on a AIX machine. Thanks. ![]() |
|
||||
|
Thanks for your answer.
I guess I need to put it this way. Assume I am running the Test.sh which is a Unix script and in the middle of Test.sh I call the sqlplus and the sqlplus successfully runs one script that has "exit" command which is the exit command for sqlplus and reaches the "exit" command and terminates the sqlplus. (I guess here is exit with return code zero otherwise I would see sqlplus prompt) but still doesn't get back to the Test.sh because my next statement after sqlplus is just a simple below code: echo "Test.sh done!" > Test.sh.log But this line never been executed. I am a novice in Unix world. If I get disappointed, I get back to AS/400... I guess who cares... Thanks a lot. ![]() |
|
||||
|
Try this:
RETURN=`sqlplus -s $USER <<END select <column> from <table_name>; quit END` if [ -z "$RETURN" ]; then echo "Error - No rows returned " exit 0 else printf "Good return" fi Depends on what you're trying to do. |
|
||||
|
Hi,
Hrere is the script: ######################################### #!/bin/sh sqlplus $CONNECT_STRING @$SCRIPTDIR/$PLSQL_SCRPIT status=$? if [ $status -ne 0 ] then echo "Error in $SCRIPTDIR/$PLSQL_SCRPIT " > $LOGFILE echo `date` >> $LOGFILE exit 10010 else echo "$PLSQL_SCRIPT finished successfully. " > $LOGFILE echo `date` >> $LOGFILE exit 0 fi ######################################### After sqlplus execution it doesn't reach the status=$? statement. Thanks a lot for your help. |
|
||||
|
Shell prog
I feel it is better to run child shell, so that once the child shell terminates, we can get the status of the shell which, in turn, returns the status of the command,....
Please repost if youneed any suggestions or research in UNIX, C,C++ and networking or kernel prog or embedded or system level.... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|