How to know return value of the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to know return value of the script
# 1  
Old 07-03-2008
How to know return value of the script

I have a script and when it is running it is showing PASSED or FAILED.But I would like to pass the results into return code.So pls provide suggession how to add return code into this script

AgcfIp=`GetSoftatcValue AgcfIp_1`
AgcfShell=`GetSoftatcValue AgcfShell_1`
AgcfPath=`GetSoftatcValue AgcfPath_1`
AgcfUser=`GetSoftatcValue AgcfUser_1`

E=`${AgcfShell} -l ${AgcfUser} ${AgcfIp} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; /usr/bin/hostname"`
D=`${AgcfShell} -l ${AgcfUser} ${AgcfIp} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; /usr/bin/uname -a"`
if [ "$D" == "SunO111S $E 5.10 Generic_127112-10 i86pc i386 i86pc" ]
then
echo "PASSED";
else
echo "FAILED";
fi
# 2  
Old 07-03-2008
Use "exit" code.
# 3  
Old 07-03-2008
u can do it by two ways...

1)u can echo the value in the child script and catch it from calling script
eg.export temp=testing.ksh
2)another way is u can write in a temp file in chile script and read from it in the parent script and remove it
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command. . /opt/app/scripts/cdc_migration.sh But it fails with the below error when I try it this way /opt/app/scripts/cdc_migration.sh /opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies

2. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

3. Shell Programming and Scripting

Doing a tail in a script and then return back and continue script

Hello all, I am trying to do a tail in a script. But when I quit the tail my script quits also. This is not what I want. I am struggling to get this done. #!/bin/bash askFile() { echo -n "Enter file: " read FILE } doTail() { tail -F "${1}" } askFile doTail... (4 Replies)
Discussion started by: markdark
4 Replies

4. Shell Programming and Scripting

How to return a value from another script

Hi! I have a parameter in an existing script, let's call the parameter param1 and the script - script1. I have another script - script2, which receives param1 and returns a certain value. I would like this value to be returned inside param1. There is no problem with script2, it runs... (5 Replies)
Discussion started by: shira
5 Replies

5. Shell Programming and Scripting

How to return a value of a variable from shell script to perl script

HI , Is there any way to return a value of variable from shell to perl script. Code: === Perl file my $diff1=system("sh diff.sh"); my $diff2=system("sh diff1.sh"); I need exit status of below commands i.e 0 and 1 respectively. Since in both the cases diff is working so system... (3 Replies)
Discussion started by: srkelect
3 Replies

6. Shell Programming and Scripting

How to return the value from the called shell script to the calling sh script

Hi all, I have two ksh scripts #sample1.sh #!/bin/ksh . ./sample2.sh echo $fileExist #sample2.sh #!/bin/ksh func() { i=1 return $a } func echo $? Here how should I return the value of sample2.sh back to sample1.sh? Thanks in advance. (2 Replies)
Discussion started by: gp_singh
2 Replies

7. Shell Programming and Scripting

how ro use return from a child script

I use return <value> to return a value from inside an else condition in child script to parent script and i am getting the following error.What is this sourced script? Can I return value to a different script using return statement. return: can only `return' from a function or sourced script (1 Reply)
Discussion started by: codeman007
1 Replies

8. 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

9. Shell Programming and Scripting

script to return value

I have 3 scripts script A - wrapper script to disguise invoker true identity script B - perform database operation and return a value (either W/H) -> return value by echoing the result script C - use script A to mask as the database owner then invoke script B to retrieve the value ... (1 Reply)
Discussion started by: mpang_
1 Replies

10. Shell Programming and Scripting

return valuse from child script to parent script

Hi, I am trying to return a value from child script to a parent script just as a function does. The child script will look for a file and if exists will return 1 else 0. I need to capture the status 1 from child script in the parent script and proceed further. if 0, i need not do... (1 Reply)
Discussion started by: borncrazy
1 Replies
Login or Register to Ask a Question