![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Invoking Oracle stored procedure in unix shell script | hidnana | Shell Programming and Scripting | 1 | 10-15-2008 04:37 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 04:05 AM |
| Invoking Shell Script via php | bubeshj | Shell Programming and Scripting | 2 | 06-30-2006 03:09 AM |
| Invoking shell script from html/jsp page | bubeshj | Shell Programming and Scripting | 2 | 06-28-2006 10:53 AM |
| Wrong Shell Invoking My Script On Linux | kowrip | Shell Programming and Scripting | 3 | 09-10-2003 07:18 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
invoking one shell script from other
hi,
i am one day old in shell scritpting. how to invoke one shell script from the other? For eg.i have two shell scripts A.sh and B.sh. Inside A.sh i need to invoke B.sh and the return code of A.sh should be the value returned by B.sh. it would be better if you provide any sample shell scripts. Thanks, Ajay. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
1.
A.sh call B.sh just put B.sh as a command in the shell script e.g. cp ... ... ls ... ... B.sh etc... Remeber the user running the script must also has execute permission for B.sh 2. The return value of A.sh is controlled by either exit <value> or the return code of the last command so if B.sh was you last command in A.sh then the return code of B.sh = return code of A.sh However if you have more commands after B.sh in the script, you can save the return value of B.sh using B.sh retcode = $? .... .... exit $retcode (differs for whatever shell you use but $? is the return code of your last command.) Hope it helps |
|
#3
|
|||
|
|||
|
invoking one shell script from other
Thanks for your reply. but still i am having some doubts
i went through some of the websites. its quoted that "use $? very rarely". is it a good practice to use this? (pradon me if i am wrong i dont have much idea in scripting) |
|
#4
|
||||
|
||||
|
Please ignore this!
another similar problem is
assume that ./a.sh will gives some output ./a.sh>a.out will redirect the output to some file a.out Now i want to do same from another script insted of directly writting in prompt. contents of b.sh will be `./a.sh>a.out` now when i run b.sh output is echoed to the screen insted of writing to a.out. How come? Some solution to this Last edited by yogesh_powar; 05-24-2006 at 12:55 AM. Reason: hey i got my mistake. please ignore this |
||||
| Google The UNIX and Linux Forums |