returned code
I have two scripts
Script1.sh Code:
#!/bin/ksh Code:
#!/bin/ksh |
change exit to return
and after you call help you need: exit $? |
It is best to show results like this:
Code:
$ ls -l Script* |
Quote:
|
Quote:
Script1.sh Code:
#!/bin/ksh Code:
#!/bin/ksh Quote:
|
you didnt say that in your 1st post.
|
Quote:
|
I think your intent was clear from the code!
|
Quote:
Its tough to post the script over here (company's policy). But the code is straight forward. Code:
getFile () { Quote:
|
Quote:
perhaps you can close this thread by completing the questions before he asks them this is all basic stuff that, if you RTFM, can be easily, easily resolved. Just try a little. bye |
Understood about your companies policy.
Try set -x before the print, to see xtrace output. We've verified ksh works; now the goal is to see why your scripts are not behaving as you expect. |
Quote:
Code:
set -x |
For the results to occur that you are seeing, some command MUST be running immediately after the exit from the second script - and returns a 0 status - and before you test the exit status code.
Sorry, in ksh, you use typeset -ft to trace functions: help() { ... } typeset -ft help |
Quote:
Code:
+ sed s%/H21%% Quote:
Code:
Function1 () { I do see that functions only till getFile are executed (based on the log) |
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. |
All times are GMT -5. The time now is 03:45 PM. |