return code not captured


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting return code not captured
# 1  
Old 09-05-2006
return code not captured

Hi all,
We have a script in our Unix box(HP-UX 11.11) which is invoked as
Code:
script1.sh param1 param2 >>${logfile}               script2.sh "param"

Actually the script2 is also called from the same line. There is no semicolon between the 2 calls. I also checked the octal dump. What happens here is that the return code of the script1 is checked in script2. 2-3 days back, script1 failed but script2 didnt catch the error.

What I would like to know is whether this is a valid syntax? And why the script2 doesnt catch the error? Any suggestions would be very helpful.

Regards,
Ranj

Last edited by ranj@chn; 09-05-2006 at 07:38 AM.. Reason: typo
# 2  
Old 09-05-2006
Code:
possibilities:
script1.sh param1 param2 >>${logfile}  ||             script2.sh $? "param"
script1.sh param1 param2 >>${logfile}     &&          script2.sh "param"

Normally, if you want script2 to "see" previous error status you have to pass status to it or have the shell intervene. The only other possibility is to have script1 write status to a file. Then script2 reads the file.
# 3  
Old 09-06-2006
thanks Jim

Thanks Jim. So, the above syntax is wrong then. I will work the suggestions and come back later.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How could I use the value of return code

Hello, I am woring on a script where I am getting strange situation.This script actually fetch the source code and tar that code and send to NAS location.This code resides in MKS tool...and we are fetching the source code on checkpoint label basis and script is working fine.First it synch the... (0 Replies)
Discussion started by: anuragpgtgerman
0 Replies

2. Shell Programming and Scripting

[Solved] Output in bash script not captured in variable

I'm tring to write down a simple script that would execute a command and wait until it returns a specific result. This is what i did: bjobs_out=`bjobs` while ]; do bjobs_out=`bjobs` sleep 6 done It seems to work until the command 'jobs' return the list of jobs in execution, but... (4 Replies)
Discussion started by: lifedj
4 Replies

3. Shell Programming and Scripting

File name should not be captured if still copying

HI, I am running a shell script on a folder where our sources files will be published for every 5 mins, I am copying all the source files(i.e .csv format) to a .txt as ls *.csv > camp.txt. Now when the above command is executing some files which are not copied completely , their name is also... (6 Replies)
Discussion started by: subhasri_2020
6 Replies

4. Shell Programming and Scripting

return code help

Hello folks, I have a question that if i type ls command and type echo $? it always show "0", how i could do this change that when i type ls it will show me 1, actually i want to change the return code of commands from 0 to 1. Thanks Bash (5 Replies)
Discussion started by: learnbash
5 Replies

5. Shell Programming and Scripting

Need help with return code 1...

Hi Guys,, I am having a unix script which is running the DB2 Insert command. For the insert command, there were no records to be updated. SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000 + + echo 1 STAGE_RC=1 + ] ... (6 Replies)
Discussion started by: mac4rfree
6 Replies

6. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

7. Shell Programming and Scripting

asking about return code

hi all my system is linux red hat i have a script that runs some object . the object return some code to the system i see the code by writing echo $? i want to ask in the script if $? equals 14 how shell is do that in the script thanks (3 Replies)
Discussion started by: naamas03
3 Replies

8. UNIX for Dummies Questions & Answers

Informix function return value needs to be captured in shell script

I need to run a 4ge from within my shell script and capture the string value that is being returned into a unix variable. I have tried the back ticks to no avail. I know it is returning because I did get the returned value to go to my screen at one point.. What I have is: sendlist =... (3 Replies)
Discussion started by: jeniferz
3 Replies

9. Cybersecurity

Reading and Manipulating captured packets (pflog file)

Hey, I currently have a set of captured sessions thru ethereal, saved in pflog files, basically its a tcpdump, which i need to go thru and sort the applications/protocols in order of the times they were used. I also need to change the headers of the packets, basically the source and destination... (0 Replies)
Discussion started by: PenguinDevil
0 Replies

10. UNIX for Advanced & Expert Users

Return code from PL/SQL Code

Hi Guys, I was just wondering if anybody can help me with this problem. OK, how we can get a value back from PL/SQL Script (not stored procedure/function) See the below example: (for example aaa.sh) #!/bin/ksh VALUE=`sqlplus -s user/password@test_id <<EOF @xxx.sq EOF` echo $VALUE ... (7 Replies)
Discussion started by: Shaz
7 Replies
Login or Register to Ask a Question