ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The code of interest is the code that sets up the call to the script above and the test for its exit status. We know the script above exits correctly with exit code 1. You can verify this with strace, by placing strace in front of the call in your other script to the script above. strace will show you the exit value.
See my edit above for setting -x on functions in ksh.
strace is giving the following error
Quote:
ERROR: unable to open /dev/log
FYI : This script is being called from an Application as well, and it too says that the script is not returning exit status properly.
Last edited by tostay2003; 08-19-2008 at 05:29 PM.
Are you on Solaris? I see you are in the non-*nix forum.
If so, use truss, not strace.
I've given you the tools I would use to see how to trace a shell script, and to see the actual exit code that is passed to the _exit(2) system call. Other than debugging with a debugger (which is likely to be far more pain than you want to endure), I'm not sure what else I can do. I don't have access to your code, I have given you code that shows you how the exit functions work, and I've given tracing tools. I'm out of suggestions.
Are you on Solaris? I see you are in the non-*nix forum.
If so, use truss, not strace.
I've given you the tools I would use to see how to trace a shell script, and to see the actual exit code that is passed to the _exit(2) system call. Other than debugging with a debugger (which is likely to be far more pain than you want to endure), I'm not sure what else I can do. I don't have access to your code, I have given you code that shows you how the exit functions work, and I've given tracing tools. I'm out of suggestions.
I made a truss on the script and obtained the below result. How to we analyze, whats happening. the '+' are from Script1 and i guess anything below is from script two (where returned code is printed)
Quote:
File=
+ [ -z ]
+ print Cannot find File : H21
Cannot find File : H21
+ exit 1
waitid(P_PID, 4958, 0xFFBFF8D0, WEXITED|WTRAPPED|WNOWAIT) = 0
ioctl(0, TIOCGPGRP, 0xFFBFF8EC) = 0
ioctl(0, TCGETS, 0x00039178) = 0
waitid(P_PID, 4958, 0xFFBFF8D0, WEXITED|WTRAPPED) = 0
brk(0x0003A3F0) = 0
Returned Code is 0
write(1, " R e t u r n e d C o d".., 19) = 19
read(19, 0x00039610, 128) = 0
ioctl(19, TCGETA, 0xFFBFFBC4) Err#25 ENOTTY
ioctl(19, TCGETA, 0xFFBFFC24) Err#25 ENOTTY
close(19) = 0
_exit(0)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.