How do I call an other shell script and wait for its completion?
I want to pass input arguments and receive returning result code. And continue running rest of codes.
How do I call an other shell script and wait for its completion? I want to pass input arguments and receive returning result code. And continue running rest of codes. |
||||
|
You don't say which shell you're using, so assuming bash, you just do
The variable rc now contains the return code from your other script. Depending on what you're trying to achieve, you might try and do more stuff, but your question is so vague, that's the best starting point. |
|||||||
|
Depending on what you're trying to do, there are two main possibilities:
Either way, if you omit the path to the other script, it'll be looked up in |
|||
|
Yet another way to do this exists. If you use the real Korn Shell (not sure about pdksh) you can have dynamically loaded functions. Create file named "main" somewhere in PATH:
Create file named "georgi" somewhere else, say
Make file main executable. Make file "georgi" not execuable. Export a variable named FPATH:
Run file "main":
This is sort of obscure, and you have to get things exactly correct, like naming the autoloaded file the same as the first function in it that you call, and not having the autoloaded file marked executable if it's in PATH and FPATH. |
|||
|